I'm using Bulletsharp with SharpDX. I managed to move an object using RigidBody.Translate()
But I can't get for the heck of it get any forces applied.
Here I build the body:
public static RigidBody BuildBody(_3Df model, float mass)
{
var vertices = new List<Vector3>();
var indices = new List<int>();
foreach (var mesh in model.Meshes)
{
vertices.AddRange(mesh.Vertices.Select(vertex => new Vector3(vertex.Pos[0], vertex.Pos[1], vertex.Pos[2])));
var meshIndices = mesh.GetIndices();
indices.AddRange(meshIndices.Select(index => (int) index));
}
CollisionShape shape = new BvhTriangleMeshShape(new TriangleIndexVertexArray(indices.ToArray(), vertices.ToArray()), true);
float mas;
Vector3 vec;
shape.GetBoundingSphere(out vec, out mas);
var body = new RigidBody(
new RigidBodyConstructionInfo(mass, new DefaultMotionState(), shape, shape.CalculateLocalInertia(mass)));
return body;
}
(Note the seemingly useless GetBoundingSphere call. Without that I get a System.AccessViolationException on the next line)
No matter which ApplyForce/Torque/Impulse function I call on the RigidBody it doesn't do anything