C# Class Universe.Physics.OpenDynamicsEngine.ODEPhysicsScene

Inheritance: Universe.Framework.Physics.PhysicsScene
Datei anzeigen Open project: Virtual-Universe/Virtual-Universe Class Usage Examples

Public Properties

Property Type Description
AllowAvGravity bool
AllowAvsToEscapeGravity bool
AllowUnderwaterPhysics bool
AvGravityHeight int
MeshSculptphysicalLOD float
ODE_STEPSIZE float
PID_D float
PID_P float
RegionTerrain System.IntPtr
SimulationChangesQueue ConcurrentQueue
WorldExtents System.Vector2
actor_name_map PhysicsActor>.Dictionary
avCapRadius float
avDensity float
avHeightFudgeFactor float
avMovementDivisorRun float
avMovementDivisorWalk float
bodyFramesAutoDisable int
forceSimplePrimMeshing bool
geomContactPointsStartthrottle int
geomCrossingFailuresBeforeOutofbounds int
gravityVector System.Vector3
gravityVectorNormalized System.Vector3
gravityx float
gravityy float
gravityz float
m_AvFlySpeed float
m_allowJump bool
m_flightCeilingHeight float
m_preJumpForceMultiplierX float
m_preJumpForceMultiplierY float
m_preJumpForceMultiplierZ float
m_preJumpTime int
m_useFlightCeilingHeight bool
m_usepreJump bool
maximumMassObject float
meshSculptLOD float
meshSculptedPrim bool
mesher IMesher
space System.IntPtr
staticPrimspace ].IntPtr[
world System.IntPtr

Protected Properties

Property Type Description
AvatarContactBounce float
ContactgeomsArray System.IntPtr
DoPhyWind bool
FrictionMovementMultiplier float
FrictionScale float
GlobalContactsArray System.IntPtr
GridSpaceScaleBits int
HashspaceHigh int
HashspaceLow int
IsLocked bool
ODETerrainHeightFieldHeights float[]
PANull Universe.Framework.Physics.PhysicsActor
RemoveQueue ConcurrentQueue
TerrainHeightFieldHeights short[]
WaterHeight double
_activeprims HashSet
_activeprimsLock object
_characters HashSet
_collisionEventDictionary PhysicsActor>.ConcurrentDictionary
_collisionEventListLock object
_contactcountLock object
_perloopContact List
_prims HashSet
contactgroup System.IntPtr
contactsPerCollision int
contactsurfacelayer float
m_channel ITerrainChannel
m_config IConfigSource
m_currentmaxContactsbeforedeath int
m_filterCollisions bool
m_global_contactcount int
m_physicsiterations int
m_rayCastManager ODERayCastRequestManager
m_region Universe.Framework.SceneInfo.RegionInfo
m_scene IScene
m_timeDilation float
m_windModule IWindModule
minimumGroundFlightOffset float
nearCallback d.NearCallback
newGlobalcontact d.Contact
nspacesPerSideX int
nspacesPerSideY int
step_time float

Public Methods

Method Description
AddAvatar ( string avName, System.Vector3 position, Quaternion rotation, System.Vector3 size, bool isFlying, uint localID, UUID UUID ) : PhysicsActor
AddCollisionEventReporting ( PhysicsActor obj ) : void
AddGravityPoint ( bool isApplyingForces, System.Vector3 position, float forceX, float forceY, float forceZ, float gravForce, float radius, int identifier ) : void
AddODECollision ( d curContact, PhysicsActor p1, PhysicsActor p2, IntPtr b1, IntPtr b2, ContactPoint maxDepthContact, int &NotSkipedCount ) : void
AddPrimShape ( UUID primID, uint localID, string name, byte physicsType, PrimitiveBaseShape shape, System.Vector3 position, System.Vector3 size, Quaternion rotation, bool isPhysical, int material, float friction, float restitution, float gravityMultiplier, float density ) : PhysicsActor
AddSimulationChange ( NoParam del ) : void

Called to queue a change to a prim to use in place of old taint mechanism so changes do have a time sequence

CalculateGravity ( float mass, System.Vector3 position, bool allowNormalGravity, float gravityModifier, System.Vector3 &forceVector ) : void
CalculateSpaceArrayItemFromPos ( System.Vector3 pos ) : int[]

Holds the space allocation logic

CalculateSpaceForGeom ( System.Vector3 pos ) : IntPtr

Calculates the space the prim should be in by its position

Collision_optimized ( float timeStep ) : void

This is our collision testing routine in ODE

Dispose ( ) : void
GetContactParam ( float mu, float AvatarContactBounce, d &newGlobalcontact ) : void
GetGravityForce ( ) : float[]
GetTerrainHeightAtXY ( float x, float y ) : float
GetTopColliders ( ) : float>.Dictionary
GetWaterLevel ( float x, float y ) : double
Initialize ( IMesher meshmerizer, IScene scene ) : void
IsNearBody ( IntPtr gspace, IntPtr g1, IntPtr g2 ) : void

This is our near callback. A geometry is near a body

ODEPhysicsScene ( ) : System

Initializes the scene Sets many properties that ODE requires to be stable These settings need to be tweaked 'exactly' right or weird stuff happens.

PostInitialize ( IConfigSource config ) : void
RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, int Count ) : List
RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, RaycastCallback retMethod ) : void
RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, int Count, RayCallback retMethod ) : void
RecalculateSpaceForGeom ( IntPtr geom, System.Vector3 pos, IntPtr currentspace ) : IntPtr

Called when a static prim moves. Allocates a space for the prim based on its position

RemCollisionEventReporting ( PhysicsActor obj ) : void
RemoveAvatar ( PhysicsActor actor ) : void
RemovePrim ( PhysicsActor prim ) : void
SetGravityForce ( bool enabled, float forceX, float forceY, float forceZ ) : void

Sets gravity parameters in the single axis, if you want a point, use the gravity point pieces

SetTerrain ( ITerrainChannel channel, short heightMap ) : void
SetWaterLevel ( double height, short map ) : void
Simulate ( float timeElapsed ) : void

This is our main simulate loop It's thread locked by a Mutex in the scene. It holds Collisions, it instructs ODE to step through the physical reactions It moves the objects around in memory It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup)

SupportsRayCast ( ) : bool
WhichSpaceAmIIn ( System.Vector3 pos ) : string

Debug space message for printing the space that a prim/avatar is in.

command ( int cmd ) : void
start ( int unused ) : void
step ( int pause ) : void

Private Methods

Method Description
AddActivePrim ( ODEPrim activatePrim ) : void
AddCharacter ( ODECharacter chr ) : void

Adds a character to the list of avatars in the scene Internally locked, as it is called only in the Simulation Changes loop

BadCharacter ( ODECharacter chr ) : void
BadPrim ( ODEPrim universeODEPrim ) : void
CheckDupe ( d contactGeom, int atype ) : bool
Collision_accounting_events ( PhysicsActor p1, PhysicsActor p2, ContactPoint contact ) : void
CreateContacJoint ( d geom ) : IntPtr
GetCurContactGeom ( int index, d &newcontactgeom ) : bool
NeedsMeshing ( ODEPrim prim, byte physicalType ) : bool

Routine to figure out if we need to mesh this prim with our mesher

RemoveActivePrim ( ODEPrim deactivatePrim ) : void
RemoveCharacter ( ODECharacter chr ) : void

Removes a character from the list of avatars currently in the scene Internally locked, as it is called only in the Simulation Changes loop

RemovePrimThreadLocked ( ODEPrim prim ) : void

This is called from within simulate but outside the locked portion We need to do our own locking here Essentially, we need to remove the prim from our space segment, whatever segment it's in. If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory that the space was using.

Method Details

AddAvatar() public method

public AddAvatar ( string avName, System.Vector3 position, Quaternion rotation, System.Vector3 size, bool isFlying, uint localID, UUID UUID ) : PhysicsActor
avName string
position System.Vector3
rotation Quaternion
size System.Vector3
isFlying bool
localID uint
UUID UUID
return Universe.Framework.Physics.PhysicsActor

AddCollisionEventReporting() public method

public AddCollisionEventReporting ( PhysicsActor obj ) : void
obj Universe.Framework.Physics.PhysicsActor
return void

AddGravityPoint() public method

public AddGravityPoint ( bool isApplyingForces, System.Vector3 position, float forceX, float forceY, float forceZ, float gravForce, float radius, int identifier ) : void
isApplyingForces bool
position System.Vector3
forceX float
forceY float
forceZ float
gravForce float
radius float
identifier int
return void

AddODECollision() public method

public AddODECollision ( d curContact, PhysicsActor p1, PhysicsActor p2, IntPtr b1, IntPtr b2, ContactPoint maxDepthContact, int &NotSkipedCount ) : void
curContact d
p1 Universe.Framework.Physics.PhysicsActor
p2 Universe.Framework.Physics.PhysicsActor
b1 System.IntPtr
b2 System.IntPtr
maxDepthContact Universe.Framework.Physics.ContactPoint
NotSkipedCount int
return void

AddPrimShape() public method

public AddPrimShape ( UUID primID, uint localID, string name, byte physicsType, PrimitiveBaseShape shape, System.Vector3 position, System.Vector3 size, Quaternion rotation, bool isPhysical, int material, float friction, float restitution, float gravityMultiplier, float density ) : PhysicsActor
primID UUID
localID uint
name string
physicsType byte
shape PrimitiveBaseShape
position System.Vector3
size System.Vector3
rotation Quaternion
isPhysical bool
material int
friction float
restitution float
gravityMultiplier float
density float
return Universe.Framework.Physics.PhysicsActor

AddSimulationChange() public method

Called to queue a change to a prim to use in place of old taint mechanism so changes do have a time sequence
public AddSimulationChange ( NoParam del ) : void
del NoParam
return void

CalculateGravity() public method

public CalculateGravity ( float mass, System.Vector3 position, bool allowNormalGravity, float gravityModifier, System.Vector3 &forceVector ) : void
mass float
position System.Vector3
allowNormalGravity bool
gravityModifier float
forceVector System.Vector3
return void

CalculateSpaceArrayItemFromPos() public method

Holds the space allocation logic
public CalculateSpaceArrayItemFromPos ( System.Vector3 pos ) : int[]
pos System.Vector3
return int[]

CalculateSpaceForGeom() public method

Calculates the space the prim should be in by its position
public CalculateSpaceForGeom ( System.Vector3 pos ) : IntPtr
pos System.Vector3
return System.IntPtr

Collision_optimized() public method

This is our collision testing routine in ODE
public Collision_optimized ( float timeStep ) : void
timeStep float
return void

Dispose() public method

public Dispose ( ) : void
return void

GetContactParam() public method

public GetContactParam ( float mu, float AvatarContactBounce, d &newGlobalcontact ) : void
mu float
AvatarContactBounce float
newGlobalcontact d
return void

GetGravityForce() public method

public GetGravityForce ( ) : float[]
return float[]

GetTerrainHeightAtXY() public method

public GetTerrainHeightAtXY ( float x, float y ) : float
x float
y float
return float

GetTopColliders() public method

public GetTopColliders ( ) : float>.Dictionary
return float>.Dictionary

GetWaterLevel() public method

public GetWaterLevel ( float x, float y ) : double
x float
y float
return double

Initialize() public method

public Initialize ( IMesher meshmerizer, IScene scene ) : void
meshmerizer IMesher
scene IScene
return void

IsNearBody() public method

This is our near callback. A geometry is near a body
public IsNearBody ( IntPtr gspace, IntPtr g1, IntPtr g2 ) : void
gspace System.IntPtr The space that contains the geoms. Remember, spaces are also geoms
g1 System.IntPtr a geometry or space
g2 System.IntPtr another geometry or space
return void

ODEPhysicsScene() public method

Initializes the scene Sets many properties that ODE requires to be stable These settings need to be tweaked 'exactly' right or weird stuff happens.
public ODEPhysicsScene ( ) : System
return System

PostInitialize() public method

public PostInitialize ( IConfigSource config ) : void
config IConfigSource
return void

RaycastWorld() public method

public RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, int Count ) : List
position System.Vector3
direction System.Vector3
length float
Count int
return List

RaycastWorld() public method

public RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, RaycastCallback retMethod ) : void
position System.Vector3
direction System.Vector3
length float
retMethod RaycastCallback
return void

RaycastWorld() public method

public RaycastWorld ( System.Vector3 position, System.Vector3 direction, float length, int Count, RayCallback retMethod ) : void
position System.Vector3
direction System.Vector3
length float
Count int
retMethod RayCallback
return void

RecalculateSpaceForGeom() public method

Called when a static prim moves. Allocates a space for the prim based on its position
public RecalculateSpaceForGeom ( IntPtr geom, System.Vector3 pos, IntPtr currentspace ) : IntPtr
geom System.IntPtr The pointer to the geom that moved
pos System.Vector3 The position that the geom moved to
currentspace System.IntPtr A pointer to the space it was in before it was moved.
return System.IntPtr

RemCollisionEventReporting() public method

public RemCollisionEventReporting ( PhysicsActor obj ) : void
obj Universe.Framework.Physics.PhysicsActor
return void

RemoveAvatar() public method

public RemoveAvatar ( PhysicsActor actor ) : void
actor Universe.Framework.Physics.PhysicsActor
return void

RemovePrim() public method

public RemovePrim ( PhysicsActor prim ) : void
prim Universe.Framework.Physics.PhysicsActor
return void

SetGravityForce() public method

Sets gravity parameters in the single axis, if you want a point, use the gravity point pieces
public SetGravityForce ( bool enabled, float forceX, float forceY, float forceZ ) : void
enabled bool Enable one axis gravity (disables point gravity)
forceX float
forceY float
forceZ float
return void

SetTerrain() public method

public SetTerrain ( ITerrainChannel channel, short heightMap ) : void
channel ITerrainChannel
heightMap short
return void

SetWaterLevel() public method

public SetWaterLevel ( double height, short map ) : void
height double
map short
return void

Simulate() public method

This is our main simulate loop It's thread locked by a Mutex in the scene. It holds Collisions, it instructs ODE to step through the physical reactions It moves the objects around in memory It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup)
public Simulate ( float timeElapsed ) : void
timeElapsed float
return void

SupportsRayCast() public method

public SupportsRayCast ( ) : bool
return bool

WhichSpaceAmIIn() public method

Debug space message for printing the space that a prim/avatar is in.
public WhichSpaceAmIIn ( System.Vector3 pos ) : string
pos System.Vector3
return string

command() public method

public command ( int cmd ) : void
cmd int
return void

start() public method

public start ( int unused ) : void
unused int
return void

step() public method

public step ( int pause ) : void
pause int
return void

Property Details

AllowAvGravity public_oe property

public bool AllowAvGravity
return bool

AllowAvsToEscapeGravity public_oe property

public bool AllowAvsToEscapeGravity
return bool

AllowUnderwaterPhysics public_oe property

public bool AllowUnderwaterPhysics
return bool

AvGravityHeight public_oe property

public int AvGravityHeight
return int

AvatarContactBounce protected_oe property

protected float AvatarContactBounce
return float

ContactgeomsArray protected_oe property

protected IntPtr,System ContactgeomsArray
return System.IntPtr

DoPhyWind protected_oe property

protected bool DoPhyWind
return bool

FrictionMovementMultiplier protected_oe property

protected float FrictionMovementMultiplier
return float

FrictionScale protected_oe property

protected float FrictionScale
return float

GlobalContactsArray protected_oe property

protected IntPtr,System GlobalContactsArray
return System.IntPtr

GridSpaceScaleBits protected_oe property

protected int GridSpaceScaleBits
return int

HashspaceHigh protected_oe property

protected int HashspaceHigh
return int

HashspaceLow protected_oe property

protected int HashspaceLow
return int

IsLocked protected_oe property

protected bool IsLocked
return bool

MeshSculptphysicalLOD public_oe property

public float MeshSculptphysicalLOD
return float

ODETerrainHeightFieldHeights protected_oe property

protected float[] ODETerrainHeightFieldHeights
return float[]

ODE_STEPSIZE public_oe property

public float ODE_STEPSIZE
return float

PANull protected_oe property

protected PhysicsActor,Universe.Framework.Physics PANull
return Universe.Framework.Physics.PhysicsActor

PID_D public_oe property

public float PID_D
return float

PID_P public_oe property

public float PID_P
return float

RegionTerrain public_oe property

public IntPtr,System RegionTerrain
return System.IntPtr

RemoveQueue protected_oe property

protected ConcurrentQueue RemoveQueue
return ConcurrentQueue

SimulationChangesQueue public_oe property

public ConcurrentQueue SimulationChangesQueue
return ConcurrentQueue

TerrainHeightFieldHeights protected_oe property

protected short[] TerrainHeightFieldHeights
return short[]

WaterHeight protected_oe property

protected double WaterHeight
return double

WorldExtents public_oe property

public Vector2,System WorldExtents
return System.Vector2

_activeprims protected_oe property

protected HashSet _activeprims
return HashSet

_activeprimsLock protected_oe property

protected object _activeprimsLock
return object

_characters protected_oe property

protected HashSet _characters
return HashSet

_collisionEventDictionary protected_oe property

protected ConcurrentDictionary _collisionEventDictionary
return PhysicsActor>.ConcurrentDictionary

_collisionEventListLock protected_oe property

protected object _collisionEventListLock
return object

_contactcountLock protected_oe property

protected object _contactcountLock
return object

_perloopContact protected_oe property

protected List _perloopContact
return List

_prims protected_oe property

protected HashSet _prims
return HashSet

actor_name_map public_oe property

public Dictionary actor_name_map
return PhysicsActor>.Dictionary

avCapRadius public_oe property

public float avCapRadius
return float

avDensity public_oe property

public float avDensity
return float

avHeightFudgeFactor public_oe property

public float avHeightFudgeFactor
return float

avMovementDivisorRun public_oe property

public float avMovementDivisorRun
return float

avMovementDivisorWalk public_oe property

public float avMovementDivisorWalk
return float

bodyFramesAutoDisable public_oe property

public int bodyFramesAutoDisable
return int

contactgroup protected_oe property

protected IntPtr,System contactgroup
return System.IntPtr

contactsPerCollision protected_oe property

protected int contactsPerCollision
return int

contactsurfacelayer protected_oe property

protected float contactsurfacelayer
return float

forceSimplePrimMeshing public_oe property

public bool forceSimplePrimMeshing
return bool

geomContactPointsStartthrottle public_oe property

public int geomContactPointsStartthrottle
return int

geomCrossingFailuresBeforeOutofbounds public_oe property

public int geomCrossingFailuresBeforeOutofbounds
return int

gravityVector public_oe property

public Vector3,System gravityVector
return System.Vector3

gravityVectorNormalized public_oe property

public Vector3,System gravityVectorNormalized
return System.Vector3

gravityx public_oe property

public float gravityx
return float

gravityy public_oe property

public float gravityy
return float

gravityz public_oe property

public float gravityz
return float

m_AvFlySpeed public_oe property

public float m_AvFlySpeed
return float

m_allowJump public_oe property

public bool m_allowJump
return bool

m_channel protected_oe property

protected ITerrainChannel m_channel
return ITerrainChannel

m_config protected_oe property

protected IConfigSource m_config
return IConfigSource

m_currentmaxContactsbeforedeath protected_oe property

protected int m_currentmaxContactsbeforedeath
return int

m_filterCollisions protected_oe property

protected bool m_filterCollisions
return bool

m_flightCeilingHeight public_oe property

public float m_flightCeilingHeight
return float

m_global_contactcount protected_oe property

protected int m_global_contactcount
return int

m_physicsiterations protected_oe property

protected int m_physicsiterations
return int

m_preJumpForceMultiplierX public_oe property

public float m_preJumpForceMultiplierX
return float

m_preJumpForceMultiplierY public_oe property

public float m_preJumpForceMultiplierY
return float

m_preJumpForceMultiplierZ public_oe property

public float m_preJumpForceMultiplierZ
return float

m_preJumpTime public_oe property

public int m_preJumpTime
return int

m_rayCastManager protected_oe property

protected ODERayCastRequestManager,Universe.Physics.OpenDynamicsEngine m_rayCastManager
return ODERayCastRequestManager

m_region protected_oe property

protected RegionInfo,Universe.Framework.SceneInfo m_region
return Universe.Framework.SceneInfo.RegionInfo

m_scene protected_oe property

protected IScene m_scene
return IScene

m_timeDilation protected_oe property

protected float m_timeDilation
return float

m_useFlightCeilingHeight public_oe property

public bool m_useFlightCeilingHeight
return bool

m_usepreJump public_oe property

public bool m_usepreJump
return bool

m_windModule protected_oe property

protected IWindModule m_windModule
return IWindModule

maximumMassObject public_oe property

public float maximumMassObject
return float

meshSculptLOD public_oe property

public float meshSculptLOD
return float

meshSculptedPrim public_oe property

public bool meshSculptedPrim
return bool

mesher public_oe property

public IMesher mesher
return IMesher

minimumGroundFlightOffset protected_oe property

protected float minimumGroundFlightOffset
return float

nearCallback protected_oe property

protected d.NearCallback nearCallback
return d.NearCallback

newGlobalcontact protected_oe property

protected d.Contact,Universe.Physics.OpenDynamicsEngine newGlobalcontact
return d.Contact

nspacesPerSideX protected_oe property

protected int nspacesPerSideX
return int

nspacesPerSideY protected_oe property

protected int nspacesPerSideY
return int

space public_oe property

public IntPtr,System space
return System.IntPtr

staticPrimspace public_oe property

public IntPtr[,] staticPrimspace
return ].IntPtr[

step_time protected_oe property

protected float step_time
return float

world public_oe property

public IntPtr,System world
return System.IntPtr