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
physicsHandlerPhysicsHandler
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
Parent
The parent game element
public GameElement Parent { get; set; }
Property Value
Methods
GetElement()
Gets the game element of the collider
public override GameElement GetElement()
Returns
GetLocation()
Gets the location of the collider
public Vector3 GetLocation()
Returns
GetPhysicsObject()
Gets the physics object of the collider
public override object GetPhysicsObject()
Returns
GetRotation()
Gets the rotation of the collider
public Quaternion GetRotation()
Returns
OnCollide(Collision)
Handles the collision event
public override void OnCollide(Collision collision)
Parameters
collisionCollision
OnDispose(BaseScene, IRenderDevice)
Disposes the collider
public override void OnDispose(BaseScene scene, IRenderDevice renderer)
Parameters
sceneBaseScenerendererIRenderDevice
OnInit(BaseScene, Viewport, IRenderDevice)
Initializes the collider
public override void OnInit(BaseScene scene, Viewport viewport, IRenderDevice renderer)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevice
OnRender(BaseScene, Viewport, IRenderDevice, Camera)
Renders the collider
public override void OnRender(BaseScene scene, Viewport viewport, IRenderDevice renderer, Camera camera)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevicecameraCamera
OnUpdate(BaseScene, float)
Updates the collider
public override void OnUpdate(BaseScene scene, float dt)
Parameters
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
rotationQuaternion
Rotate(Vector3)
Rotates the collider by the given value in degrees
public void Rotate(Vector3 rotation)
Parameters
rotationVector3
Rotate(float)
Rotates the collider by the given value around the Z axis in degrees
public void Rotate(float value)
Parameters
valuefloat
SetElement(GameElement)
Sets the game element of the collider
public override void SetElement(GameElement gameElement)
Parameters
gameElementGameElement
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
valueVector3