This is my first attempt in 3d graphics, and I wanna create simple car game. I know that bepu provides Vehicle object, but I have no idea how to start with it. Basically, I would like to achieve something similar to this: http://www.youtube.com/watch?v=lR0NjIAm ... r_embedded.
I started my work with:
Code: Select all
Vector3[] rawVertices = new Vector3[terrain.vertices.Length];
for (int i = 0; i < terrain.vertices.Length; i++)
{
rawVertices[i] = terrain.vertices[i].Position;
}
// car contents here
var bodies = new List<CompoundShapeEntry>
{
new CompoundShapeEntry(new BoxShape(2.5f, 10f, 4.5f), new Vector3(0, 1000, 0), 60),
new CompoundShapeEntry(new BoxShape(2.5f, 10f, 2f), new Vector3(0, 1000, .5f), 1)
};
var body = new CompoundBody(bodies, 61);
body.CollisionInformation.LocalPosition = new Vector3(0, 1000f, 0);
body.Position = new Vector3(0, 1000, 0); //At first, just keep it out of the way.
Vehicle = new Vehicle(body);
space = new Space();
space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);
var mesh = new StaticMesh(rawVertices, terrain.indices, new AffineTransform(new Vector3(0, 0, 0)));
space.Add(mesh);
space.Add(Vehicle);