Class RigidBodyBehavior
- Namespace
- LibGFX.Physics.Behaviors2D
- Assembly
- LibGFX.dll
Represents a 2D rigid body behavior
public abstract class RigidBodyBehavior : PhysicsBehavior, IGameBehavior
- Inheritance
-
RigidBodyBehavior
- Implements
- Derived
- Inherited Members
Constructors
RigidBodyBehavior(PhysicsHandler)
Creates a new 2D rigid body behavior
public RigidBodyBehavior(PhysicsHandler physicsHandler)
Parameters
physicsHandlerPhysicsHandler
Properties
AngularVelocity
The angular factor of the rigid body
public Vector3 AngularVelocity { get; set; }
Property Value
Friction
Gets or sets the friction of the rigid body
public float Friction { get; set; }
Property Value
LinearVelocity
The linear velocity of the rigid body
public Vector3 LinearVelocity { get; set; }
Property Value
Offset
The offset of the rigid body
public Vector3 Offset { get; set; }
Property Value
Parent
The parent game element of the rigid body
public GameElement Parent { get; set; }
Property Value
Restitution
Gets or sets the restitution of the rigid body
public float Restitution { get; set; }
Property Value
RigidBody
The rigid body of the behavior
public RigidBody RigidBody { get; set; }
Property Value
- RigidBody
Methods
ApplyCentralForce(Vector2)
Applies a central force to the rigid body
public void ApplyCentralForce(Vector2 force)
Parameters
forceVector2
ApplyCentralImpulse(Vector2)
Applies a central impulse to the rigid body
public void ApplyCentralImpulse(Vector2 impulse)
Parameters
impulseVector2
ApplyCentralImpulse(Vector3)
Applies a central impulse to the rigid body
public void ApplyCentralImpulse(Vector3 impulse)
Parameters
impulseVector3
ApplyCentralImpulse(float)
Applies a central impulse to the rigid body
public void ApplyCentralImpulse(float impulse)
Parameters
impulsefloat
ApplyImpulse(Vector2, Vector3)
Applies a impulse to the rigid body
public void ApplyImpulse(Vector2 impulse, Vector3 relpos)
Parameters
ApplyImpulse(Vector3, Vector3)
Applies a impulse to the rigid body
public void ApplyImpulse(Vector3 impulse, Vector3 relpos)
Parameters
CalculateForwardVector(float)
Calculates the forward vector of the rigid body
public Vector3 CalculateForwardVector(float distance)
Parameters
distancefloat
Returns
CalculateRightVector(float)
Calculates the right vector of the rigid body
public Vector3 CalculateRightVector(float distance)
Parameters
distancefloat
Returns
CalculateUpVector(float)
Calculates the up vector of the rigid body
public Vector3 CalculateUpVector(float distance)
Parameters
distancefloat
Returns
GetAngularFactor()
Gets the angular factor of the rigid body
public Vector3 GetAngularFactor()
Returns
GetAngularVelocity()
Gets the angular velocity of the rigid body
public Vector3 GetAngularVelocity()
Returns
GetElement()
Gets the parent game element of the rigid body
public override GameElement GetElement()
Returns
GetLinearFactor()
Gets the linear factor of the rigid body
public Vector3 GetLinearFactor()
Returns
GetLinearVelocity()
Gets the linear velocity of the rigid body
public Vector3 GetLinearVelocity()
Returns
GetLocation()
Gets the location of the rigid body
public Vector3 GetLocation()
Returns
GetPhysicsObject()
Gets the physics object of the rigid body
public override object GetPhysicsObject()
Returns
GetRotation()
Gets the rotation of the rigid body
public Quaternion GetRotation()
Returns
OnCollide(Collision)
Handles the collision of the rigid body
public override void OnCollide(Collision collision)
Parameters
collisionCollision
OnDispose(BaseScene, IRenderDevice)
Disposes the rigid body behavior
public override void OnDispose(BaseScene scene, IRenderDevice renderer)
Parameters
sceneBaseScenerendererIRenderDevice
OnInit(BaseScene, Viewport, IRenderDevice)
Initializes the rigid body behavior
public override void OnInit(BaseScene scene, Viewport viewport, IRenderDevice renderer)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevice
OnRender(BaseScene, Viewport, IRenderDevice, Camera)
Renders the rigid body behavior
public override void OnRender(BaseScene scene, Viewport viewport, IRenderDevice renderer, Camera camera)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevicecameraCamera
OnUpdate(BaseScene, float)
Updates the rigid body behavior
public override void OnUpdate(BaseScene scene, float dt)
Parameters
RemoveRigidBody()
Removes the rigid body from the physics handler
public virtual void RemoveRigidBody()
Rotate(Quaternion)
Rotates the rigid body by the given quaternion
public virtual void Rotate(Quaternion rotation)
Parameters
rotationQuaternion
Rotate(Vector3)
Rotates the rigid body by the given angle in degrees
public virtual void Rotate(Vector3 rotation)
Parameters
rotationVector3
Rotate(float)
Rotates the rigid body by the given angle in degrees
public virtual void Rotate(float angle)
Parameters
anglefloat
SetAngularFactor(Vector3)
Sets the angular factor of the rigid body
public void SetAngularFactor(Vector3 value)
Parameters
valueVector3
SetAngularVelocity(Vector3)
Sets the angular velocity of the rigid body
public void SetAngularVelocity(Vector3 velocity)
Parameters
velocityVector3
SetAngularVelocity(float)
Sets the angular velocity of the rigid body
public void SetAngularVelocity(float velocity)
Parameters
velocityfloat
SetElement(GameElement)
Sets the parent game element of the rigid body
public override void SetElement(GameElement gameElement)
Parameters
gameElementGameElement
SetLinearFactor(Vector2)
Sets the linear factor of the rigid body
public void SetLinearFactor(Vector2 value)
Parameters
valueVector2
SetLinearFactor(Vector3)
Sets the linear factor of the rigid body
public void SetLinearFactor(Vector3 value)
Parameters
valueVector3
SetLinearVelocity(Vector2)
Sets the linear velocity of the rigid body
public void SetLinearVelocity(Vector2 velocity)
Parameters
velocityVector2
SetLinearVelocity(Vector3)
Sets the linear velocity of the rigid body
public void SetLinearVelocity(Vector3 velocity)
Parameters
velocityVector3
Sync()
Syncs the rigid body with the parent game element
public void Sync()
Translate(Vector2)
Translates the rigid body by the given value
public void Translate(Vector2 translation)
Parameters
translationVector2
Translate(Vector3)
Translates the rigid body by the given value
public void Translate(Vector3 translation)
Parameters
translationVector3