Class ColliderBehavior2D
Represents a 2D collider behavior for a physics object in the Genesis game engine.
Inheritance
Inherited Members
Namespace: Genesis.Physics
Assembly: Genesis.dll
Syntax
public abstract class ColliderBehavior2D : PhysicsBehavior
Remarks
Provides methods for creating and manipulating a collider object, including translation and rotation.
Constructors
ColliderBehavior2D(PhysicHandler)
Initializes a new instance of the ColliderBehavior2D class with the specified physics handler.
Declaration
public ColliderBehavior2D(PhysicHandler physicHandler)
Parameters
Type | Name | Description |
---|---|---|
PhysicHandler | physicHandler | The physics handler to associate with this collider behavior. |
Properties
Collider
Gets or sets the collision object associated with this collider behavior.
Declaration
public CollisionObject Collider { get; set; }
Property Value
Type | Description |
---|---|
CollisionObject |
Offset
Gets or sets the offset position for the collider.
Declaration
public Vec3 Offset { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
PhysicHandler
Gets or sets the physics handler associated with this collider behavior.
Declaration
public PhysicHandler PhysicHandler { get; set; }
Property Value
Type | Description |
---|---|
PhysicHandler |
Methods
CreateCollider()
Creates the collider object.
Declaration
public abstract void CreateCollider()
GetPhysicsObject()
Gets the physics object associated with this behavior.
Declaration
public override object GetPhysicsObject()
Returns
Type | Description |
---|---|
object | The collision object representing the collider. |
Overrides
GetPhysicsObject<T>()
Gets the physics object associated with this behavior, cast to the specified type.
Declaration
public override T GetPhysicsObject<T>()
Returns
Type | Description |
---|---|
T | The collision object representing the collider, cast to the specified type. |
Type Parameters
Name | Description |
---|---|
T | The type to cast the physics object to. |
Overrides
OnDestroy(Game, GameElement)
Called when the collider is destroyed.
Declaration
public override void OnDestroy(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
GameElement | parent | The parent game element. |
Overrides
OnInit(Game, GameElement)
Called when the collider is initialized.
Declaration
public override void OnInit(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
GameElement | parent | The parent game element. |
Overrides
OnRender(Game, GameElement)
Called when the collider is rendered.
Declaration
public override void OnRender(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
GameElement | parent | The parent game element. |
Overrides
OnUpdate(Game, GameElement)
Updates the collider's position and rotation each frame.
Declaration
public override void OnUpdate(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game instance. |
GameElement | parent | The parent game element. |
Overrides
Rotate(Vec3)
Rotates the collider by the specified vector.
Declaration
public void Rotate(Vec3 value)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | value | The vector specifying the rotation values. |
Rotate(float)
Rotates the collider by the specified z value.
Declaration
public void Rotate(float z)
Parameters
Type | Name | Description |
---|---|---|
float | z | The rotation value around the z-axis. |
Translate(Vec3)
Translates the collider by the specified vector.
Declaration
public void Translate(Vec3 value)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | value | The vector specifying the translation values. |
Translate(float, float)
Translates the collider by the specified x and y values.
Declaration
public void Translate(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The translation value along the x-axis. |
float | y | The translation value along the y-axis. |