Class PhysicsHandler2D
Represents a 2D physics handler responsible for managing physics simulation in a game.
Inherited Members
Namespace: Genesis.Physics
Assembly: Genesis.dll
Syntax
public class PhysicsHandler2D : PhysicHandler
Constructors
PhysicsHandler2D(float, float)
Initializes a new instance of the PhysicsHandler2D class with specified gravity values.
Declaration
public PhysicsHandler2D(float gravityX, float gravityY)
Parameters
Type | Name | Description |
---|---|---|
float | gravityX | The X component of gravity. |
float | gravityY | The Y component of gravity. |
Properties
PhysicsWorld
Gets or sets the 2D physics world used for simulation.
Declaration
public DiscreteDynamicsWorld PhysicsWorld { get; set; }
Property Value
Type | Description |
---|---|
DiscreteDynamicsWorld |
ProcessPhysics
Gets or sets a flag indicating whether physics simulation should be processed.
Declaration
public bool ProcessPhysics { get; set; }
Property Value
Type | Description |
---|---|
bool |
Substepps
Gets ore sets the substepps for physic simulation
Declaration
public int Substepps { get; set; }
Property Value
Type | Description |
---|---|
int |
TickRate
Gets or sets the tick rate for physics simulation.
Declaration
public float TickRate { get; set; }
Property Value
Type | Description |
---|---|
float |
Methods
ManageElement(PhysicsBehavior, int, int)
Manages a physics behavior element by adding its RigidBody to the physics world.
Declaration
public override void ManageElement(PhysicsBehavior physicsBehavior, int collisionFilterGroup = -1, int collisionMaskGroup = -1)
Parameters
Type | Name | Description |
---|---|---|
PhysicsBehavior | physicsBehavior | The PhysicsBehavior representing the collision object. |
int | collisionFilterGroup | |
int | collisionMaskGroup |
Overrides
Process(Scene, Game)
Processes the physics simulation for the given scene and game.
Declaration
public override void Process(Scene scene, Game game)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The current game scene. |
Game | game | The current game instance. |
Overrides
RemoveElement(PhysicsBehavior)
Removes the specified physics behavior from the physics world.
Declaration
public override void RemoveElement(PhysicsBehavior physicsBehavior)
Parameters
Type | Name | Description |
---|---|---|
PhysicsBehavior | physicsBehavior | The physics behavior to be removed. |
Overrides
Remarks
This method removes the collision object associated with the provided physics behavior from the physics world.