Class RigidBodyBehavior2D
Represents a 2D rigid body behavior in a physics simulation.
Inherited Members
Namespace: Genesis.Physics
Assembly: Genesis.dll
Syntax
public abstract class RigidBodyBehavior2D : PhysicsBehavior
Constructors
RigidBodyBehavior2D(PhysicHandler)
Initializes a new instance of the RigidBodyBehavior2D class with the specified physics handler.
Declaration
public RigidBodyBehavior2D(PhysicHandler handler)
Parameters
Type | Name | Description |
---|---|---|
PhysicHandler | handler | The physics handler. |
Properties
Offset
Gets or sets the offset vector.
Declaration
public Vec3 Offset { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
PhysicHandler
Gets or sets the physics handler.
Declaration
public PhysicHandler PhysicHandler { get; set; }
Property Value
Type | Description |
---|---|
PhysicHandler |
RigidBody
Gets or sets the rigid body associated with this behavior.
Declaration
public RigidBody RigidBody { get; set; }
Property Value
Type | Description |
---|---|
RigidBody |
Methods
AngularVelocity(Vec3)
Sets the angular velocity of the rigid body using a vector.
Declaration
public virtual void AngularVelocity(Vec3 value)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | value | The angular velocity vector. |
AngularVelocity(float)
Sets the angular velocity of the rigid body around the Z-axis.
Declaration
public virtual void AngularVelocity(float z)
Parameters
Type | Name | Description |
---|---|---|
float | z | The angular velocity around the Z-axis. |
CreateRigidBody(float)
Creates a rigid body with the specified mass.
Declaration
public abstract void CreateRigidBody(float mass)
Parameters
Type | Name | Description |
---|---|---|
float | mass | The mass of the rigid body. |
GetPhysicsObject()
Gets the physics object associated with this behavior.
Declaration
public override object GetPhysicsObject()
Returns
Type | Description |
---|---|
object | The physics object. |
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 physics object cast to the specified type. |
Type Parameters
Name | Description |
---|---|
T | The type to cast the physics object to. |
Overrides
LinearVelocity(Vec3)
Sets the linear velocity of the rigid body using a vector.
Declaration
public virtual void LinearVelocity(Vec3 value)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | value | The linear velocity vector. |
LinearVelocity(float, float)
Sets the linear velocity of the rigid body using X and Y values.
Declaration
public virtual void LinearVelocity(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The linear velocity along the X-axis. |
float | y | The linear velocity along the Y-axis. |
OnDestroy(Game, GameElement)
Destroys the physics behavior.
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)
Initializes the physics behavior.
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)
Renders the physics behavior.
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 physics behavior.
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 rigid body by the specified vector.
Declaration
public virtual void Rotate(Vec3 value)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | value | The rotation vector. |
Rotate(float)
Rotates the rigid body by the specified angle around the Z-axis.
Declaration
public virtual void Rotate(float z)
Parameters
Type | Name | Description |
---|---|---|
float | z | The angle to rotate by, in radians. |
Translate(Vec3)
Translates the rigid body by the specified vector.
Declaration
public virtual void Translate(Vec3 value)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | value | The translation vector. |
Translate(float, float)
Translates the rigid body by the specified X and Y values.
Declaration
public virtual void Translate(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The translation along the X-axis. |
float | y | The translation along the Y-axis. |