Need help with gravity and collision
Posted: Wed Oct 05, 2011 7:57 pm
Hey everybody,
So I started using Bepu recently and I'm pretty new to game developing.I have some problems -
After searching for hours I finally got an object to fall to the ground.But there seems to be something wrong, the object falls to the ground at a constant velocity.
Gravity is supposed to accelerate falling objects right? This is the code -
And also, changing the mass of the capsule doesn't seem to make any difference... Anybody knows what I'm doing wrong?
Thanks for your time.
So I started using Bepu recently and I'm pretty new to game developing.I have some problems -
After searching for hours I finally got an object to fall to the ground.But there seems to be something wrong, the object falls to the ground at a constant velocity.
Gravity is supposed to accelerate falling objects right? This is the code -
Code: Select all
Entity testshape;
//Load Content
Space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);
Testobj = Content.Load<Model>("Models\\testshape");
testshape = new Capsule(new Vector3(0, 100, 0), 100, 10,10);
Space.Add(testshape);
//Update
Space.Update();
//Draw
Matrix[] testobjtransforms = new Matrix[Chamber.Bones.Count];
Testobj.CopyAbsoluteBoneTransformsTo(testobjtransforms);
foreach (ModelMesh mesh in Testobj.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World = testobjtransforms[mesh.ParentBone.Index] *
Matrix.CreateRotationY(MathHelper.ToRadians(90)) * testshape.WorldTransform ; //This is the part I'm unsure.Is this OK?
effect.Projection = projection;
effect.View = view;
}
mesh.Draw();
}
Thanks for your time.