Class PhysicsBox2D
Inherited Members
Namespace: Genesis.Core.Behaviors.Physics2D
Assembly: Genesis.dll
Syntax
public class PhysicsBox2D : PhysicsBehavior
Constructors
PhysicsBox2D()
Declaration
public PhysicsBox2D()
Properties
AngularFactor
Gets or sets the angular factor for the RigidBody's rotation.
Declaration
public Vec3 AngularFactor { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
EnablePhysic
Declaration
public bool EnablePhysic { get; set; }
Property Value
Type | Description |
---|---|
bool |
LinearFactor
Gets or sets the linear factor for the RigidBody's motion.
Declaration
public Vec3 LinearFactor { get; set; }
Property Value
Type | Description |
---|---|
Vec3 |
RigidBody
Gets or sets the RigidBody associated with this 2D physics behavior.
Declaration
public RigidBody RigidBody { get; set; }
Property Value
Type | Description |
---|---|
RigidBody |
Methods
CreateRigidbody(PhysicHandler, float)
Creates a RigidBody with the specified mass using the provided PhysicHandler.
Declaration
public void CreateRigidbody(PhysicHandler handler, float mass)
Parameters
Type | Name | Description |
---|---|---|
PhysicHandler | handler | The PhysicHandler responsible for managing physics elements. |
float | mass | The mass of the RigidBody. |
GetPhysicsObject()
Gets the physics object associated with this behavior.
Declaration
public override object GetPhysicsObject()
Returns
Type | Description |
---|---|
object | The RigidBody 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 RigidBody physics object cast to the specified type. |
Type Parameters
Name | Description |
---|---|
T | The type to which the physics object is cast. |
Overrides
OnDestroy(Game, GameElement)
Called when the associated game element is being destroyed.
Declaration
public override void OnDestroy(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The current game instance. |
GameElement | parent | The parent game element associated with this behavior. |
Overrides
OnInit(Game, GameElement)
Called when the associated game element is being initialized.
Declaration
public override void OnInit(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The current game instance. |
GameElement | parent | The parent game element associated with this behavior. |
Overrides
OnRender(Game, GameElement)
Called during the rendering phase of the game update cycle.
Declaration
public override void OnRender(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The current game instance. |
GameElement | parent | The parent game element associated with this behavior. |
Overrides
OnUpdate(Game, GameElement)
Updates the behavior during the game's update cycle.
Declaration
public override void OnUpdate(Game game, GameElement parent)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The current game instance. |
GameElement | parent | The parent game element associated with this behavior. |
Overrides
UpdateRigidBody()
Updates the RigidBody's motion state based on the parent's location.
Declaration
public void UpdateRigidBody()