C# Class Ballz.GameSession.Physics.PhysicsControl

Physics control is called by BallzGame update to simulate discrete GamePhysics.
In each update step, this component syncs the state of all entities into the physics world, runs a simulation step, and syncs positions and velocities back to the entities.
Inheritance: Microsoft.Xna.Framework.GameComponent
Show file Open project: SpagAachen/Ballz Class Usage Examples

Public Methods

Method Description
AddRope ( Rope rope ) : void
HandleMessage ( object sender, Message message ) : void
Initialize ( ) : void
IsEmpty ( Vector2 Position ) : bool
LoosenRope ( Rope rope ) : void
PhysicsControl ( Ballz game ) : Ballz.GameSession.World
PhysicsStep ( World worldState, float elapsedSeconds ) : void

Runs a single simulation step in the physics engine and syncs the state of the physics bodies back to the given world.

PreparePhysicsEngine ( World worldState ) : void

Syncs the given world state into the physics world. Creates new physics bodies for entities that don't have one yet.

Raycast ( Vector2 rayStart, Vector2 rayEnd ) : RaycastResult
RemoveBody ( Body body ) : void
RemoveEntity ( Entity e, World worldState ) : void

Removes the physics body of the given entity from the physics world.

RemoveRope ( Rope rope ) : void
ShortenRope ( Rope rope ) : void
Update ( GameTime time ) : void
UpdateTerrainBody ( Terrain terrain ) : void

Removes the old terrain physics bodies and replaces them with new ones, generated from the given terrain.

Method Details

AddRope() public method

public AddRope ( Rope rope ) : void
rope Ballz.GameSession.World.Rope
return void

HandleMessage() public method

public HandleMessage ( object sender, Message message ) : void
sender object
message Ballz.Messages.Message
return void

Initialize() public method

public Initialize ( ) : void
return void

IsEmpty() public method

public IsEmpty ( Vector2 Position ) : bool
Position Vector2
return bool

LoosenRope() public method

public LoosenRope ( Rope rope ) : void
rope Ballz.GameSession.World.Rope
return void

PhysicsControl() public method

public PhysicsControl ( Ballz game ) : Ballz.GameSession.World
game Ballz
return Ballz.GameSession.World

PhysicsStep() public method

Runs a single simulation step in the physics engine and syncs the state of the physics bodies back to the given world.
public PhysicsStep ( World worldState, float elapsedSeconds ) : void
worldState World
elapsedSeconds float
return void

PreparePhysicsEngine() public method

Syncs the given world state into the physics world. Creates new physics bodies for entities that don't have one yet.
public PreparePhysicsEngine ( World worldState ) : void
worldState World
return void

Raycast() public method

public Raycast ( Vector2 rayStart, Vector2 rayEnd ) : RaycastResult
rayStart Vector2
rayEnd Vector2
return RaycastResult

RemoveBody() public method

public RemoveBody ( Body body ) : void
body FarseerPhysics.Dynamics.Body
return void

RemoveEntity() public method

Removes the physics body of the given entity from the physics world.
public RemoveEntity ( Entity e, World worldState ) : void
e Entity
worldState World
return void

RemoveRope() public method

public RemoveRope ( Rope rope ) : void
rope Ballz.GameSession.World.Rope
return void

ShortenRope() public method

public ShortenRope ( Rope rope ) : void
rope Ballz.GameSession.World.Rope
return void

Update() public method

public Update ( GameTime time ) : void
time GameTime
return void

UpdateTerrainBody() public method

Removes the old terrain physics bodies and replaces them with new ones, generated from the given terrain.
public UpdateTerrainBody ( Terrain terrain ) : void
terrain Ballz.GameSession.World.Terrain
return void