Show / Hide Table of Contents

Class MyPhysicsComponentBase

Inheritance
System.Object
MyComponentBase
MyEntityComponentBase
MyPhysicsComponentBase
Inherited Members
MyEntityComponentBase.Container
MyEntityComponentBase.AttachSyncToEntity
MyEntityComponentBase.OnAfterAddedToContainer
MyEntityComponentBase.BeforeRemovedFromContainer
MyComponentBase.SetContainer(IMyComponentContainer)
MyComponentBase.GetAs<T>()
MyComponentBase.OnAddedToScene()
MyComponentBase.OnRemovedFromScene()
MyComponentBase.RemoveExistingComponentOnNewInsert
MyComponentBase.ContainerBase
Namespace: VRage.Game.Components
Assembly: VRage.Game.dll
Syntax
[MyComponentType]
public abstract class MyPhysicsComponentBase : MyEntityComponentBase, IMyEntityComponentBase, IMyComponentBase

Constructors

MyPhysicsComponentBase()

Declaration
protected MyPhysicsComponentBase()

Fields

ContactPointDelay

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
Type Description
RigidBodyFlag

IsPhantom

Use something from Havok to detect this

Declaration
public bool IsPhantom
Field Value
Type Description
System.Boolean

m_enabled

Declaration
protected bool m_enabled
Field Value
Type Description
System.Boolean

m_lastAngularVelocity

Declaration
protected Vector3 m_lastAngularVelocity
Field Value
Type Description
Vector3

m_lastLinearVelocity

Declaration
protected Vector3 m_lastLinearVelocity
Field Value
Type Description
Vector3

Properties

AngularAcceleration

Declaration
public virtual Vector3 AngularAcceleration { get; protected set; }
Property Value
Type Description
Vector3

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
Type Description
Vector3

AngularVelocityLocal

Declaration
public virtual Vector3 AngularVelocityLocal { get; set; }
Property Value
Type Description
Vector3

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
Type Description
Vector3

CenterOfMassLocal

Declaration
public abstract Vector3 CenterOfMassLocal { get; }
Property Value
Type Description
Vector3

CenterOfMassWorld

Declaration
public abstract Vector3D CenterOfMassWorld { get; }
Property Value
Type Description
Vector3D

ComponentTypeDebugString

Declaration
public override string ComponentTypeDebugString { get; }
Property Value
Type Description
System.String
Overrides
MyEntityComponentBase.ComponentTypeDebugString

Definition

Declaration
public MyPhysicsComponentDefinitionBase Definition { get; }
Property Value
Type Description
MyPhysicsComponentDefinitionBase

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
Type Description
IMyEntity

Friction

Declaration
public abstract float Friction { get; set; }
Property Value
Type Description
System.Single

Gravity

Declaration
public abstract Vector3 Gravity { get; set; }
Property Value
Type Description
Vector3

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
Type Description
Vector3

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
Type Description
Vector3

LinearVelocityUnsafe

Declaration
public virtual Vector3 LinearVelocityUnsafe { get; set; }
Property Value
Type Description
Vector3

Mass

Gets or sets the 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
Type Description
MyStringHash

The type of the material.

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.

ReportAllContacts

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

Gets or sets the 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
Type Description
Vector3

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)

Applies the impulse.

Declaration
public abstract void ApplyImpulse(Vector3 dir, Vector3D pos)
Parameters
Type Name Description
Vector3 dir

The dir.

Vector3D pos

The pos.

Clear()

Clear all dynamic values of physics object.

Declaration
public abstract void Clear()

ClearSpeed()

Clears the speeds.

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
Type Description
Vector3D

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
Type Name Description
MyObjectBuilder_ComponentBase baseBuilder
Overrides
MyComponentBase.Deserialize(MyObjectBuilder_ComponentBase)

ForceActivate()

Declaration
public abstract void ForceActivate()

GetMaterialAt(Vector3D)

Declaration
public virtual MyStringHash GetMaterialAt(Vector3D worldPos)
Parameters
Type Name Description
Vector3D worldPos
Returns
Type Description
MyStringHash

GetVelocityAtPoint(Vector3D)

Declaration
public abstract Vector3 GetVelocityAtPoint(Vector3D worldPos)
Parameters
Type Name Description
Vector3D worldPos
Returns
Type Description
Vector3

GetVelocityAtPointLocal(ref Vector3D, out Vector3)

Declaration
public abstract void GetVelocityAtPointLocal(ref Vector3D worldPos, out Vector3 linearVelocity)
Parameters
Type Name Description
Vector3D worldPos
Vector3 linearVelocity

GetWorldMatrix()

Declaration
public MatrixD GetWorldMatrix()
Returns
Type Description
MatrixD

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
Type Name Description
MyComponentDefinitionBase definition
Overrides
MyComponentBase.Init(MyComponentDefinitionBase)

IsSerialized()

Declaration
public override bool IsSerialized()
Returns
Type Description
System.Boolean
Overrides
MyComponentBase.IsSerialized()

OnAddedToContainer()

Declaration
public override void OnAddedToContainer()
Overrides
MyEntityComponentBase.OnAddedToContainer()

OnBeforeRemovedFromContainer()

Declaration
public override void OnBeforeRemovedFromContainer()
Overrides
MyEntityComponentBase.OnBeforeRemovedFromContainer()

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
Type Description
MyObjectBuilder_ComponentBase
Overrides
MyComponentBase.Serialize(Boolean)

SetSpeeds(Vector3, Vector3)

Set the current linear and angular velocities of this physics body.

Declaration
public void SetSpeeds(Vector3 linear, Vector3 angular)
Parameters
Type Name Description
Vector3 linear
Vector3 angular

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
Type Name Description
Vector3D worldPos
Returns
Type Description
Vector3D

Events

OnBodyActiveStateChanged

OnBodyActiveStateChanged event - arg1 - Sender, arg2 - is active

Declaration
public abstract event Action<MyPhysicsComponentBase, bool> OnBodyActiveStateChanged
Event Type
Type Description
System.Action<MyPhysicsComponentBase, System.Boolean>

Extension Methods

MyEntityContainerEventExtensions.RegisterForEntityEvent(MyEntityComponentBase, MyStringHash, MyEntityContainerEventExtensions.EntityEventHandler)
MyEntityContainerEventExtensions.RegisterForEntityEvent(MyEntityComponentBase, MyEntity, MyStringHash, MyEntityContainerEventExtensions.EntityEventHandler)
MyEntityContainerEventExtensions.UnregisterForEntityEvent(MyEntityComponentBase, MyEntity, MyStringHash)
MyEntityContainerEventExtensions.RaiseEntityEvent(MyEntityComponentBase, MyStringHash, MyEntityContainerEventExtensions.EntityEventParams)
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾