Table of Contents

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

physicsHandler PhysicsHandler

Properties

AngularVelocity

The angular factor of the rigid body

public Vector3 AngularVelocity { get; set; }

Property Value

Vector3

Friction

Gets or sets the friction of the rigid body

public float Friction { get; set; }

Property Value

float

LinearVelocity

The linear velocity of the rigid body

public Vector3 LinearVelocity { get; set; }

Property Value

Vector3

Offset

The offset of the rigid body

public Vector3 Offset { get; set; }

Property Value

Vector3

Parent

The parent game element of the rigid body

public GameElement Parent { get; set; }

Property Value

GameElement

Restitution

Gets or sets the restitution of the rigid body

public float Restitution { get; set; }

Property Value

float

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

force Vector2

ApplyCentralImpulse(Vector2)

Applies a central impulse to the rigid body

public void ApplyCentralImpulse(Vector2 impulse)

Parameters

impulse Vector2

ApplyCentralImpulse(Vector3)

Applies a central impulse to the rigid body

public void ApplyCentralImpulse(Vector3 impulse)

Parameters

impulse Vector3

ApplyCentralImpulse(float)

Applies a central impulse to the rigid body

public void ApplyCentralImpulse(float impulse)

Parameters

impulse float

ApplyImpulse(Vector2, Vector3)

Applies a impulse to the rigid body

public void ApplyImpulse(Vector2 impulse, Vector3 relpos)

Parameters

impulse Vector2
relpos Vector3

ApplyImpulse(Vector3, Vector3)

Applies a impulse to the rigid body

public void ApplyImpulse(Vector3 impulse, Vector3 relpos)

Parameters

impulse Vector3
relpos Vector3

CalculateForwardVector(float)

Calculates the forward vector of the rigid body

public Vector3 CalculateForwardVector(float distance)

Parameters

distance float

Returns

Vector3

CalculateRightVector(float)

Calculates the right vector of the rigid body

public Vector3 CalculateRightVector(float distance)

Parameters

distance float

Returns

Vector3

CalculateUpVector(float)

Calculates the up vector of the rigid body

public Vector3 CalculateUpVector(float distance)

Parameters

distance float

Returns

Vector3

GetAngularFactor()

Gets the angular factor of the rigid body

public Vector3 GetAngularFactor()

Returns

Vector3

GetAngularVelocity()

Gets the angular velocity of the rigid body

public Vector3 GetAngularVelocity()

Returns

Vector3

GetElement()

Gets the parent game element of the rigid body

public override GameElement GetElement()

Returns

GameElement

GetLinearFactor()

Gets the linear factor of the rigid body

public Vector3 GetLinearFactor()

Returns

Vector3

GetLinearVelocity()

Gets the linear velocity of the rigid body

public Vector3 GetLinearVelocity()

Returns

Vector3

GetLocation()

Gets the location of the rigid body

public Vector3 GetLocation()

Returns

Vector3

GetPhysicsObject()

Gets the physics object of the rigid body

public override object GetPhysicsObject()

Returns

object

GetRotation()

Gets the rotation of the rigid body

public Quaternion GetRotation()

Returns

Quaternion

OnCollide(Collision)

Handles the collision of the rigid body

public override void OnCollide(Collision collision)

Parameters

collision Collision

OnDispose(BaseScene, IRenderDevice)

Disposes the rigid body behavior

public override void OnDispose(BaseScene scene, IRenderDevice renderer)

Parameters

scene BaseScene
renderer IRenderDevice

OnInit(BaseScene, Viewport, IRenderDevice)

Initializes the rigid body behavior

public override void OnInit(BaseScene scene, Viewport viewport, IRenderDevice renderer)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice

OnRender(BaseScene, Viewport, IRenderDevice, Camera)

Renders the rigid body behavior

public override void OnRender(BaseScene scene, Viewport viewport, IRenderDevice renderer, Camera camera)

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice
camera Camera

OnUpdate(BaseScene, float)

Updates the rigid body behavior

public override void OnUpdate(BaseScene scene, float dt)

Parameters

scene BaseScene
dt float

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

rotation Quaternion

Rotate(Vector3)

Rotates the rigid body by the given angle in degrees

public virtual void Rotate(Vector3 rotation)

Parameters

rotation Vector3

Rotate(float)

Rotates the rigid body by the given angle in degrees

public virtual void Rotate(float angle)

Parameters

angle float

SetAngularFactor(Vector3)

Sets the angular factor of the rigid body

public void SetAngularFactor(Vector3 value)

Parameters

value Vector3

SetAngularVelocity(Vector3)

Sets the angular velocity of the rigid body

public void SetAngularVelocity(Vector3 velocity)

Parameters

velocity Vector3

SetAngularVelocity(float)

Sets the angular velocity of the rigid body

public void SetAngularVelocity(float velocity)

Parameters

velocity float

SetElement(GameElement)

Sets the parent game element of the rigid body

public override void SetElement(GameElement gameElement)

Parameters

gameElement GameElement

SetLinearFactor(Vector2)

Sets the linear factor of the rigid body

public void SetLinearFactor(Vector2 value)

Parameters

value Vector2

SetLinearFactor(Vector3)

Sets the linear factor of the rigid body

public void SetLinearFactor(Vector3 value)

Parameters

value Vector3

SetLinearVelocity(Vector2)

Sets the linear velocity of the rigid body

public void SetLinearVelocity(Vector2 velocity)

Parameters

velocity Vector2

SetLinearVelocity(Vector3)

Sets the linear velocity of the rigid body

public void SetLinearVelocity(Vector3 velocity)

Parameters

velocity Vector3

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

translation Vector2

Translate(Vector3)

Translates the rigid body by the given value

public void Translate(Vector3 translation)

Parameters

translation Vector3