Class MyPhysicsComponentBase
Inheritance
System.Object
MyPhysicsComponentBase
Assembly: VRage.Game.dll
Syntax
[MyComponentType]
public abstract class MyPhysicsComponentBase : MyEntityComponentBase, IMyEntityComponentBase, IMyComponentBase
Constructors
MyPhysicsComponentBase()
Declaration
protected MyPhysicsComponentBase()
Fields
Must be set before creating rigid body
Declaration
public ushort ContactPointDelay
Field Value
Type |
Description |
System.UInt16 |
|
EnabledChanged
Declaration
public Action EnabledChanged
Field Value
Type |
Description |
System.Action |
|
Flags
Declaration
public RigidBodyFlag Flags
Field Value
IsPhantom
Use something from Havok to detect this
Declaration
Field Value
Type |
Description |
System.Boolean |
|
m_enabled
Declaration
Field Value
Type |
Description |
System.Boolean |
|
m_lastAngularVelocity
Declaration
protected Vector3 m_lastAngularVelocity
Field Value
m_lastLinearVelocity
Declaration
protected Vector3 m_lastLinearVelocity
Field Value
Properties
AngularAcceleration
Declaration
public virtual Vector3 AngularAcceleration { get; protected set; }
Property Value
AngularDamping
Gets or sets the angular damping.
Declaration
public abstract float AngularDamping { get; set; }
Property Value
Type |
Description |
System.Single |
The angular damping.
|
AngularVelocity
Declaration
public virtual Vector3 AngularVelocity { get; set; }
Property Value
AngularVelocityLocal
Declaration
public virtual Vector3 AngularVelocityLocal { get; set; }
Property Value
BreakableBody
Declaration
public abstract HkdBreakableBody BreakableBody { get; set; }
Property Value
Type |
Description |
Havok.HkdBreakableBody |
|
CanUpdateAccelerations
Declaration
public bool CanUpdateAccelerations { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Center
Declaration
public Vector3 Center { get; set; }
Property Value
CenterOfMassLocal
Declaration
public abstract Vector3 CenterOfMassLocal { get; }
Property Value
CenterOfMassWorld
Declaration
public abstract Vector3D CenterOfMassWorld { get; }
Property Value
ComponentTypeDebugString
Declaration
public override string ComponentTypeDebugString { get; }
Property Value
Type |
Description |
System.String |
|
Overrides
Definition
Declaration
public MyPhysicsComponentDefinitionBase Definition { get; }
Property Value
Enabled
Gets or sets a value indicating whether this is enabled.
Declaration
public virtual bool Enabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
true if enabled; otherwise, false .
|
Entity
Declaration
public IMyEntity Entity { get; protected set; }
Property Value
Friction
Declaration
public abstract float Friction { get; set; }
Property Value
Type |
Description |
System.Single |
|
Gravity
Declaration
public abstract Vector3 Gravity { get; set; }
Property Value
HasRigidBody
Declaration
public abstract bool HasRigidBody { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsActive
Declaration
public abstract bool IsActive { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsInWorld
Declaration
public virtual bool IsInWorld { get; protected set; }
Property Value
Type |
Description |
System.Boolean |
|
IsKinematic
Gets or sets a value indicating whether this is kinematic.
Declaration
public virtual bool IsKinematic { get; }
Property Value
Type |
Description |
System.Boolean |
true if kinematic; otherwise, false .
|
IsMoving
Declaration
public abstract bool IsMoving { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsStatic
Gets or sets a value indicating whether this is static.
Declaration
public virtual bool IsStatic { get; }
Property Value
Type |
Description |
System.Boolean |
true if static; otherwise, false .
|
LinearAcceleration
Declaration
public virtual Vector3 LinearAcceleration { get; protected set; }
Property Value
LinearDamping
Gets or sets the linear damping.
Declaration
public abstract float LinearDamping { get; set; }
Property Value
Type |
Description |
System.Single |
The linear damping.
|
LinearVelocity
Gets or sets the linear velocity.
Declaration
public virtual Vector3 LinearVelocity { get; set; }
Property Value
Type |
Description |
Vector3 |
The linear velocity.
|
LinearVelocityLocal
Declaration
public virtual Vector3 LinearVelocityLocal { get; set; }
Property Value
LinearVelocityUnsafe
Declaration
public virtual Vector3 LinearVelocityUnsafe { get; set; }
Property Value
Mass
Declaration
public abstract float Mass { get; }
Property Value
Type |
Description |
System.Single |
The mass.
|
MaterialType
Gets or sets the type of the material.
Declaration
public MyStringHash MaterialType { get; set; }
Property Value
PlayCollisionCueEnabled
Gets or sets a value indicating whether [play collision cue enabled].
Declaration
public bool PlayCollisionCueEnabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
true if [play collision cue enabled]; otherwise, false .
|
Declaration
public bool ReportAllContacts { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
RigidBody
Obtain/set (default) rigid body of this physics object.
Declaration
public abstract HkRigidBody RigidBody { get; protected set; }
Property Value
Type |
Description |
Havok.HkRigidBody |
|
RigidBody2
Obtain/set secondary rigid body of this physics object (not used by default, it is used sometimes on grids for kinematic layer).
Declaration
public abstract HkRigidBody RigidBody2 { get; protected set; }
Property Value
Type |
Description |
Havok.HkRigidBody |
|
ShapeChangeInProgress
Declaration
public virtual bool ShapeChangeInProgress { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Speed
Declaration
public abstract float Speed { get; }
Property Value
Type |
Description |
System.Single |
The speed.
|
SupportNormal
Declaration
public virtual Vector3 SupportNormal { get; set; }
Property Value
Methods
Activate()
Activates this rigid body in physics.
Declaration
public abstract void Activate()
AddForce(MyPhysicsForceType, Nullable<Vector3>, Nullable<Vector3D>, Nullable<Vector3>, Nullable<Single>, Boolean, Boolean)
Applies external force to the physics object.
Declaration
public abstract void AddForce(MyPhysicsForceType type, Nullable<Vector3> force, Nullable<Vector3D> position, Nullable<Vector3> torque, Nullable<float> maxSpeed = null, bool applyImmediately = true, bool activeOnly = false)
Parameters
Type |
Name |
Description |
MyPhysicsForceType |
type |
The type.
|
System.Nullable<Vector3> |
force |
The force.
|
System.Nullable<Vector3D> |
position |
The position.
|
System.Nullable<Vector3> |
torque |
The torque.
|
System.Nullable<System.Single> |
maxSpeed |
Clamp max speed
|
System.Boolean |
applyImmediately |
Apply immediately or enqueue to apply right before simulation
|
System.Boolean |
activeOnly |
Only apply if the object is already active
|
ApplyImpulse(Vector3, Vector3D)
Declaration
public abstract void ApplyImpulse(Vector3 dir, Vector3D pos)
Parameters
Clear()
Clear all dynamic values of physics object.
Declaration
public abstract void Clear()
ClearSpeed()
Declaration
public abstract void ClearSpeed()
Close()
Declaration
public virtual void Close()
CloseRigidBody()
Declaration
protected abstract void CloseRigidBody()
ClusterToWorld(Vector3)
Converts local cluster position to global space.
Declaration
public abstract Vector3D ClusterToWorld(Vector3 clusterPos)
Parameters
Type |
Name |
Description |
Vector3 |
clusterPos |
|
Returns
CreateCharacterCollision(Vector3, Single, Single, Single, Single, Single, Single, MatrixD, Single, UInt16, Boolean, Single, Single, Single, Boolean, Nullable<Single>)
Declaration
public abstract void CreateCharacterCollision(Vector3 center, float characterWidth, float characterHeight, float crouchHeight, float ladderHeight, float headSize, float headHeight, MatrixD worldTransform, float mass, ushort collisionLayer, bool isOnlyVertical, float maxSlope, float maxLimit, float maxSpeedRelativeToShip, bool networkProxy, Nullable<float> maxForce)
Parameters
Type |
Name |
Description |
Vector3 |
center |
|
System.Single |
characterWidth |
|
System.Single |
characterHeight |
|
System.Single |
crouchHeight |
|
System.Single |
ladderHeight |
|
System.Single |
headSize |
|
System.Single |
headHeight |
|
MatrixD |
worldTransform |
|
System.Single |
mass |
|
System.UInt16 |
collisionLayer |
|
System.Boolean |
isOnlyVertical |
|
System.Single |
maxSlope |
|
System.Single |
maxLimit |
|
System.Single |
maxSpeedRelativeToShip |
|
System.Boolean |
networkProxy |
|
System.Nullable<System.Single> |
maxForce |
|
Deactivate()
Deactivates this rigid body in physics.
Declaration
public abstract void Deactivate()
DebugDraw()
Debug draw of this physics object.
Declaration
public abstract void DebugDraw()
Deserialize(MyObjectBuilder_ComponentBase)
Declaration
public override void Deserialize(MyObjectBuilder_ComponentBase baseBuilder)
Parameters
Overrides
ForceActivate()
Declaration
public abstract void ForceActivate()
GetMaterialAt(Vector3D)
Declaration
public virtual MyStringHash GetMaterialAt(Vector3D worldPos)
Parameters
Returns
GetVelocityAtPoint(Vector3D)
Declaration
public abstract Vector3 GetVelocityAtPoint(Vector3D worldPos)
Parameters
Returns
GetVelocityAtPointLocal(ref Vector3D, out Vector3)
Declaration
public abstract void GetVelocityAtPointLocal(ref Vector3D worldPos, out Vector3 linearVelocity)
Parameters
GetWorldMatrix()
Declaration
public MatrixD GetWorldMatrix()
Returns
GetWorldMatrix(out MatrixD)
Declaration
public abstract void GetWorldMatrix(out MatrixD matrix)
Parameters
Type |
Name |
Description |
MatrixD |
matrix |
|
Init(MyComponentDefinitionBase)
Declaration
public override void Init(MyComponentDefinitionBase definition)
Parameters
Overrides
IsSerialized()
Declaration
public override bool IsSerialized()
Returns
Type |
Description |
System.Boolean |
|
Overrides
OnAddedToContainer()
Declaration
public override void OnAddedToContainer()
Overrides
OnBeforeRemovedFromContainer()
Declaration
public override void OnBeforeRemovedFromContainer()
Overrides
OnWorldPositionChanged(Object)
Called when [world position changed].
Declaration
public abstract void OnWorldPositionChanged(object source)
Parameters
Type |
Name |
Description |
System.Object |
source |
The source object that caused this event.
|
Serialize(Boolean)
Declaration
public override MyObjectBuilder_ComponentBase Serialize(bool copy = false)
Parameters
Type |
Name |
Description |
System.Boolean |
copy |
|
Returns
Overrides
SetSpeeds(Vector3, Vector3)
Set the current linear and angular velocities of this physics body.
Declaration
public void SetSpeeds(Vector3 linear, Vector3 angular)
Parameters
UpdateAccelerations()
Declaration
public void UpdateAccelerations()
UpdateFromSystem()
Declaration
public abstract void UpdateFromSystem()
WorldToCluster(Vector3D)
Converts global space position to local cluster space.
Declaration
public abstract Vector3D WorldToCluster(Vector3D worldPos)
Parameters
Returns
Events
OnBodyActiveStateChanged
OnBodyActiveStateChanged event - arg1 - Sender, arg2 - is active
Declaration
public abstract event Action<MyPhysicsComponentBase, bool> OnBodyActiveStateChanged
Event Type
Extension Methods