Space Engineers
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Properties | List of all members
Sandbox.Engine.Physics.MyPhysics Class Reference
Inheritance diagram for Sandbox.Engine.Physics.MyPhysics:
VRage.Game.Components.MySessionComponentBase VRage.Game.Components.Interfaces.IMyUserInputComponent

Classes

struct  CollisionLayers
 Collision layers that can be used to filter what collision should be found for casting methods. More...
 
struct  FractureImpactDetails
 
struct  HitInfo
 
struct  MyContactPointEvent
 

Public Member Functions

override void LoadData ()
 
override void Simulate ()
 
bool GetEntityReplicableExistsById (long entityId)
 
- Public Member Functions inherited from VRage.Game.Components.MySessionComponentBase
virtual bool UpdatedBeforeInit ()
 
 MySessionComponentBase ()
 
void SetUpdateOrder (MyUpdateOrder order)
 
virtual void InitFromDefinition (MySessionComponentDefinition definition)
 
virtual void Init (MyObjectBuilder_SessionComponent sessionComponent)
 
virtual MyObjectBuilder_SessionComponent GetObjectBuilder ()
 
void AfterLoadData ()
 
void UnloadDataConditional ()
 
virtual void SaveData ()
 
virtual void BeforeStart ()
 
virtual void UpdateBeforeSimulation ()
 
virtual void UpdateAfterSimulation ()
 
virtual void UpdatingStopped ()
 
virtual void Draw ()
 
virtual void HandleInput ()
 
override string ToString ()
 

Static Public Member Functions

static void AssertThread ()
 
static HkWorld CreateHkWorld (float broadphaseSize=100000)
 
static void ActivateInBox (ref BoundingBoxD box)
 
static void EnqueueDestruction (FractureImpactDetails details)
 
static void RemoveDestructions (MyEntity entity)
 
static void RemoveDestructions (HkRigidBody body)
 
static void DebugDrawClusters ()
 
static void CastRay (Vector3D from, Vector3D to, List< HitInfo > toList, int raycastFilterLayer=0)
 
static HitInfo CastRay (Vector3D from, Vector3D to, int raycastFilterLayer=0)
 
static bool CastRay (Vector3D from, Vector3D to, out HitInfo hitInfo, uint raycastCollisionFilter, bool ignoreConvexShape)
 
static HitInfo CastLongRay (Vector3D from, Vector3D to, bool any=false)
 Finds closest or any object on the path of the ray from->to. Uses Storage for voxels for faster search but only good for long rays (more or less more than 50m). Use it only in such cases. More...
 
static void GetPenetrationsShape (HkShape shape, ref Vector3D translation, ref Quaternion rotation, List< HkBodyCollision > results, int filter)
 
static float CastShape (Vector3D to, HkShape shape, ref MatrixD transform, int filterLayer, float extraPenetration=0)
 
static float CastShapeInAllWorlds (Vector3D to, HkShape shape, ref MatrixD transform, int filterLayer, float extraPenetration=0)
 
static void GetPenetrationsBox (ref Vector3 halfExtents, ref Vector3D translation, ref Quaternion rotation, List< HkBodyCollision > results, int filter)
 
static Vector3D CastShapeReturnPoint (Vector3D to, HkShape shape, ref MatrixD transform, int filterLayer, float extraPenetration)
 
static HkContactPoint CastShapeReturnContact (Vector3D to, HkShape shape, ref MatrixD transform, int filterLayer, float extraPenetration, out Vector3 worldTranslation)
 
static HkContactPointData CastShapeReturnContactData (Vector3D to, HkShape shape, ref MatrixD transform, uint collisionFilter, float extraPenetration, bool ignoreConvexShape=true)
 
static HitInfo CastShapeReturnContactBodyData (Vector3D to, HkShape shape, ref MatrixD transform, uint collisionFilter, float extraPenetration, bool ignoreConvexShape=true)
 
static bool CastShapeReturnContactBodyDatas (Vector3D to, HkShape shape, ref MatrixD transform, uint collisionFilter, float extraPenetration, List< HitInfo > result, bool ignoreConvexShape=true)
 
static bool IsPenetratingShapeShape (HkShape shape1, ref Vector3D translation1, ref Quaternion rotation1, HkShape shape2, ref Vector3D translation2, ref Quaternion rotation2)
 
static bool IsPenetratingShapeShape (HkShape shape1, ref Matrix transform1, HkShape shape2, ref Matrix transform2)
 
static int GetCollisionLayer (string strLayer)
 
static void EnsurePhysicsSpace (BoundingBoxD aabb)
 Ensure aabb is inside only one subspace. If no, reorder. More...
 
static void MoveObject (ulong id, BoundingBoxD aabb, Vector3 velocity)
 Change position of object in world. Move object between subspaces if necessary. More...
 
static void RemoveObject (ulong id)
 Remove object from world, remove also subspace if empty. More...
 
static Vector3D GetObjectOffset (ulong id)
 Return offset of objects subspace center. More...
 
static ulong AddObject (BoundingBoxD bbox, MyPhysicsBody activationHandler, ulong?customId, string tag, long entityId)
 Try add object to some subspace. Create new subspace if allowed (!SingleCluster.HasValue) and needed (object is outside of existing subspaces). If not allowed, mark object as left the world. More...
 
static VRage.Collections.ListReader< object > GetClusterList ()
 
static void GetAll (List< VRageMath.Spatial.MyClusterTree.MyClusterQueryResult > results)
 
static void SerializeClusters (List< BoundingBoxD > list)
 
static void DeserializeClusters (List< BoundingBoxD > list)
 

Static Public Attributes

static int ThreadId
 
static MyHavokCluster Clusters
 
static bool DebugDrawClustersEnable = false
 
static MatrixD DebugDrawClustersMatrix = MatrixD.Identity
 

Protected Member Functions

override void UnloadData ()
 

Properties

static int StepsLastSecond [get]
 Number of physics steps done in last second More...
 
static float SimulationRatio [get]
 Simulation ratio, when physics cannot keep up, this is smaller than 1 More...
 
static float RestingVelocity [get]
 
static HkWorld SingleWorld [get]
 
static bool InsideSimulation [get]
 
- Properties inherited from VRage.Game.Components.MySessionComponentBase
MyUpdateOrder UpdateOrder [get]
 
MyObjectBuilderType ObjectBuilderType [get]
 
bool Loaded [get]
 
bool Initialized [get]
 
MyDefinitionId Definition [get, set]
 
virtual Type[] Dependencies [get]
 
virtual bool IsRequiredByGame [get]
 Indicates whether a session component should be used in current configuration. Example: MyDestructionData component returns true only when game uses Havok Destruction More...
 

Additional Inherited Members

- Public Attributes inherited from VRage.Game.Components.MySessionComponentBase
readonly string DebugName
 
readonly int Priority
 
readonly Type ComponentType
 
IMySession Session
 

Detailed Description

Definition at line 47 of file MyPhysics.cs.

Member Function Documentation

static void Sandbox.Engine.Physics.MyPhysics.ActivateInBox ( ref BoundingBoxD  box)
inlinestatic

Definition at line 749 of file MyPhysics.cs.

static ulong Sandbox.Engine.Physics.MyPhysics.AddObject ( BoundingBoxD  bbox,
MyPhysicsBody  activationHandler,
ulong?  customId,
string  tag,
long  entityId 
)
inlinestatic

Try add object to some subspace. Create new subspace if allowed (!SingleCluster.HasValue) and needed (object is outside of existing subspaces). If not allowed, mark object as left the world.

Parameters
bbox
velocity
activationHandler
customId
Returns

Definition at line 1531 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.AssertThread ( )
inlinestatic

Definition at line 384 of file MyPhysics.cs.

static HitInfo Sandbox.Engine.Physics.MyPhysics.CastLongRay ( Vector3D  from,
Vector3D  to,
bool  any = false 
)
inlinestatic

Finds closest or any object on the path of the ray from->to. Uses Storage for voxels for faster search but only good for long rays (more or less more than 50m). Use it only in such cases.

Parameters
fromStart of the ray.
toEnd of the ray.
anyIndicates if method should return any object found (May not be closest)
Returns
Hit info.

Definition at line 1076 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.CastRay ( Vector3D  from,
Vector3D  to,
List< HitInfo toList,
int  raycastFilterLayer = 0 
)
inlinestatic

Definition at line 952 of file MyPhysics.cs.

static HitInfo Sandbox.Engine.Physics.MyPhysics.CastRay ( Vector3D  from,
Vector3D  to,
int  raycastFilterLayer = 0 
)
inlinestatic

Definition at line 990 of file MyPhysics.cs.

static bool Sandbox.Engine.Physics.MyPhysics.CastRay ( Vector3D  from,
Vector3D  to,
out HitInfo  hitInfo,
uint  raycastCollisionFilter,
bool  ignoreConvexShape 
)
inlinestatic

Definition at line 1035 of file MyPhysics.cs.

static float Sandbox.Engine.Physics.MyPhysics.CastShape ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
int  filterLayer,
float  extraPenetration = 0 
)
inlinestatic

Definition at line 1189 of file MyPhysics.cs.

static float Sandbox.Engine.Physics.MyPhysics.CastShapeInAllWorlds ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
int  filterLayer,
float  extraPenetration = 0 
)
inlinestatic

Definition at line 1207 of file MyPhysics.cs.

static HkContactPoint Sandbox.Engine.Physics.MyPhysics.CastShapeReturnContact ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
int  filterLayer,
float  extraPenetration,
out Vector3  worldTranslation 
)
inlinestatic

Definition at line 1267 of file MyPhysics.cs.

static HitInfo Sandbox.Engine.Physics.MyPhysics.CastShapeReturnContactBodyData ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
uint  collisionFilter,
float  extraPenetration,
bool  ignoreConvexShape = true 
)
inlinestatic

Definition at line 1319 of file MyPhysics.cs.

static bool Sandbox.Engine.Physics.MyPhysics.CastShapeReturnContactBodyDatas ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
uint  collisionFilter,
float  extraPenetration,
List< HitInfo result,
bool  ignoreConvexShape = true 
)
inlinestatic

Definition at line 1347 of file MyPhysics.cs.

static HkContactPointData Sandbox.Engine.Physics.MyPhysics.CastShapeReturnContactData ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
uint  collisionFilter,
float  extraPenetration,
bool  ignoreConvexShape = true 
)
inlinestatic

Definition at line 1294 of file MyPhysics.cs.

static Vector3D Sandbox.Engine.Physics.MyPhysics.CastShapeReturnPoint ( Vector3D  to,
HkShape  shape,
ref MatrixD  transform,
int  filterLayer,
float  extraPenetration 
)
inlinestatic

Definition at line 1244 of file MyPhysics.cs.

static HkWorld Sandbox.Engine.Physics.MyPhysics.CreateHkWorld ( float  broadphaseSize = 100000)
inlinestatic

Definition at line 454 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.DebugDrawClusters ( )
inlinestatic

Definition at line 820 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.DeserializeClusters ( List< BoundingBoxD list)
inlinestatic

Definition at line 1582 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.EnqueueDestruction ( FractureImpactDetails  details)
inlinestatic

Definition at line 766 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.EnsurePhysicsSpace ( BoundingBoxD  aabb)
inlinestatic

Ensure aabb is inside only one subspace. If no, reorder.

Parameters
aabb

Definition at line 1485 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.GetAll ( List< VRageMath.Spatial.MyClusterTree.MyClusterQueryResult results)
inlinestatic

Definition at line 1551 of file MyPhysics.cs.

static VRage.Collections.ListReader<object> Sandbox.Engine.Physics.MyPhysics.GetClusterList ( )
inlinestatic

Definition at line 1544 of file MyPhysics.cs.

static int Sandbox.Engine.Physics.MyPhysics.GetCollisionLayer ( string  strLayer)
inlinestatic

Definition at line 1428 of file MyPhysics.cs.

bool Sandbox.Engine.Physics.MyPhysics.GetEntityReplicableExistsById ( long  entityId)
inline

Definition at line 1607 of file MyPhysics.cs.

static Vector3D Sandbox.Engine.Physics.MyPhysics.GetObjectOffset ( ulong  id)
inlinestatic

Return offset of objects subspace center.

Parameters
id
Returns

Definition at line 1516 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.GetPenetrationsBox ( ref Vector3  halfExtents,
ref Vector3D  translation,
ref Quaternion  rotation,
List< HkBodyCollision >  results,
int  filter 
)
inlinestatic

Definition at line 1232 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.GetPenetrationsShape ( HkShape  shape,
ref Vector3D  translation,
ref Quaternion  rotation,
List< HkBodyCollision >  results,
int  filter 
)
inlinestatic

Definition at line 1177 of file MyPhysics.cs.

static bool Sandbox.Engine.Physics.MyPhysics.IsPenetratingShapeShape ( HkShape  shape1,
ref Vector3D  translation1,
ref Quaternion  rotation1,
HkShape  shape2,
ref Vector3D  translation2,
ref Quaternion  rotation2 
)
inlinestatic

Definition at line 1385 of file MyPhysics.cs.

static bool Sandbox.Engine.Physics.MyPhysics.IsPenetratingShapeShape ( HkShape  shape1,
ref Matrix  transform1,
HkShape  shape2,
ref Matrix  transform2 
)
inlinestatic

Definition at line 1410 of file MyPhysics.cs.

override void Sandbox.Engine.Physics.MyPhysics.LoadData ( )
inlinevirtual

Reimplemented from VRage.Game.Components.MySessionComponentBase.

Definition at line 389 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.MoveObject ( ulong  id,
BoundingBoxD  aabb,
Vector3  velocity 
)
inlinestatic

Change position of object in world. Move object between subspaces if necessary.

Parameters
id
oldAabb
aabb
velocity

Definition at line 1497 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.RemoveDestructions ( MyEntity  entity)
inlinestatic

Definition at line 773 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.RemoveDestructions ( HkRigidBody  body)
inlinestatic

Definition at line 793 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.RemoveObject ( ulong  id)
inlinestatic

Remove object from world, remove also subspace if empty.

Parameters
id

Definition at line 1506 of file MyPhysics.cs.

static void Sandbox.Engine.Physics.MyPhysics.SerializeClusters ( List< BoundingBoxD list)
inlinestatic

Definition at line 1577 of file MyPhysics.cs.

override void Sandbox.Engine.Physics.MyPhysics.Simulate ( )
inlinevirtual

Reimplemented from VRage.Game.Components.MySessionComponentBase.

Definition at line 566 of file MyPhysics.cs.

override void Sandbox.Engine.Physics.MyPhysics.UnloadData ( )
inlineprotectedvirtual

Reimplemented from VRage.Game.Components.MySessionComponentBase.

Definition at line 529 of file MyPhysics.cs.

Member Data Documentation

MyHavokCluster Sandbox.Engine.Physics.MyPhysics.Clusters
static

Definition at line 150 of file MyPhysics.cs.

bool Sandbox.Engine.Physics.MyPhysics.DebugDrawClustersEnable = false
static

Definition at line 816 of file MyPhysics.cs.

MatrixD Sandbox.Engine.Physics.MyPhysics.DebugDrawClustersMatrix = MatrixD.Identity
static

Definition at line 817 of file MyPhysics.cs.

int Sandbox.Engine.Physics.MyPhysics.ThreadId
static

Definition at line 148 of file MyPhysics.cs.

Property Documentation

bool Sandbox.Engine.Physics.MyPhysics.InsideSimulation
staticget

Definition at line 1426 of file MyPhysics.cs.

float Sandbox.Engine.Physics.MyPhysics.RestingVelocity
staticget

Definition at line 184 of file MyPhysics.cs.

float Sandbox.Engine.Physics.MyPhysics.SimulationRatio
staticget

Simulation ratio, when physics cannot keep up, this is smaller than 1

Definition at line 171 of file MyPhysics.cs.

HkWorld Sandbox.Engine.Physics.MyPhysics.SingleWorld
staticget

Definition at line 1416 of file MyPhysics.cs.

int Sandbox.Engine.Physics.MyPhysics.StepsLastSecond
staticget

Number of physics steps done in last second

Definition at line 165 of file MyPhysics.cs.


The documentation for this class was generated from the following file: