Table of Contents

Class CollisionBehavior

Namespace
LibGFX.Physics.Behaviors2D
Assembly
LibGFX.dll

Represents a 2D collision behavior

public class CollisionBehavior : PhysicsBehavior, IGameBehavior
Inheritance
CollisionBehavior
Implements
Derived
Inherited Members

Constructors

CollisionBehavior(PhysicsHandler)

Creates a new 2D collision behavior

public CollisionBehavior(PhysicsHandler physicsHandler)

Parameters

physicsHandler PhysicsHandler

Properties

Collider

The collision object

public CollisionObject Collider { get; set; }

Property Value

CollisionObject

Offset

The offset of the collider

public Vector3 Offset { get; set; }

Property Value

Vector3

Parent

The parent game element

public GameElement Parent { get; set; }

Property Value

GameElement

Methods

GetElement()

Gets the game element of the collider

public override GameElement GetElement()

Returns

GameElement

GetLocation()

Gets the location of the collider

public Vector3 GetLocation()

Returns

Vector3

GetPhysicsObject()

Gets the physics object of the collider

public override object GetPhysicsObject()

Returns

object

GetRotation()

Gets the rotation of the collider

public Quaternion GetRotation()

Returns

Quaternion

OnCollide(Collision)

Handles the collision event

public override void OnCollide(Collision collision)

Parameters

collision Collision

OnDispose(BaseScene, IRenderDevice)

Disposes the collider

public override void OnDispose(BaseScene scene, IRenderDevice renderer)

Parameters

scene BaseScene
renderer IRenderDevice

OnInit(BaseScene, Viewport, IRenderDevice)

Initializes the collider

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

Parameters

scene BaseScene
viewport Viewport
renderer IRenderDevice

OnRender(BaseScene, Viewport, IRenderDevice, Camera)

Renders the collider

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 collider

public override void OnUpdate(BaseScene scene, float dt)

Parameters

scene BaseScene
dt float

RemoveCollider()

Removes the collider from the physics handler

public virtual void RemoveCollider()

Rotate(Quaternion)

Rotates the collider by the given quaternion

public void Rotate(Quaternion rotation)

Parameters

rotation Quaternion

Rotate(Vector3)

Rotates the collider by the given value in degrees

public void Rotate(Vector3 rotation)

Parameters

rotation Vector3

Rotate(float)

Rotates the collider by the given value around the Z axis in degrees

public void Rotate(float value)

Parameters

value float

SetElement(GameElement)

Sets the game element of the collider

public override void SetElement(GameElement gameElement)

Parameters

gameElement GameElement

Sync()

Syncs the collider with the parent game element

public void Sync()

Translate(Vector3)

Translates the collider by the given value

public void Translate(Vector3 value)

Parameters

value Vector3