Method CreateBody
- Namespace
- Box3D
- Assembly
- Box3D.NET.dll
CreateBody(BodyDefinition)
Creates a body in this world.
public Body CreateBody(BodyDefinition definition)Parameters
definitionBodyDefinition-
The body's initial state.
Returns
- Body
-
The new body, with no shapes attached yet.
Examples
Body crate = world.CreateBody(BodyDefinition.Dynamic(new Vector3(0, 5, 0)));
crate.AddBox(Box.Cube(0.5f));
Exceptions
- ObjectDisposedException
-
The world has been disposed.
CreateBody(BodyType, Vector3)
Creates a body with the default settings for its type.
public Body CreateBody(BodyType type, Vector3 position = default)Parameters
typeBodyType-
How the body participates in the simulation.
positionVector3-
The initial world position.
Returns
- Body
-
The new body.