Class GameExtensions
Extension methods for IGame that set up the Box2D helpers.
public static class GameExtensions
- Inheritance
-
GameExtensions
Methods
AddGrabber2D(IGame, Box2DSimulation)
Puts a Grabber2DScript for simulation on the camera entity, so the left mouse
button picks up any dynamic body, drags it across its plane and throws it on release.
public static Grabber2DScript AddGrabber2D(this IGame game, Box2DSimulation simulation)
Parameters
gameIGameThe game whose camera entity gets the grabber.
simulationBox2DSimulationThe simulation whose bodies can be grabbed.
Returns
- Grabber2DScript
The grabber, for tuning its button, spring and force.
Remarks
The script is also a Game Studio component, under Physics, for a project that would rather place it on the camera entity in the editor; its simulation is then set from code, since a simulation is not an asset.
Exceptions
- ArgumentNullException
If
gameorsimulationis null.