Gravity seems too weak - object falling too slowly.

Post Reply
taylorius
Posts: 1
Joined: Mon Jul 23, 2012 4:00 pm

Gravity seems too weak - object falling too slowly.

Post by taylorius »

Hi

I am simulating an object falling under gravity from a height.

I set the object to fall from 20 units up, with gravity set to 10. The units I am using are the default, which I understand to be meters and seconds (I don't set them).
I believe it ought to take my object 2 seconds to fall to the ground from 20 meters up. However, it seems to take way longer, (over 10 seconds) - so I'm certain I'm doing something wrong! :-)

I call StepSimulation(0.1) , leaving the maxSubSteps and fixedTimeStep to be their default. From the docs, it seems like it should be ok.

If anyone can shed any light on what I may be doing wrong, I would be most grateful

Best Regards

Matt Taylor
quzox
Posts: 7
Joined: Wed Aug 01, 2012 9:08 pm

Re: Gravity seems too weak - object falling too slowly.

Post by quzox »

Your numbers do work out, also using "vel_post = vel_pre + (accel * time)" setting accel = -10 and time = 0.1 then the velocity should be decreasing by 1 after every call to stepSimulation(0.1f). You can verify that in a debugger, just inspect the numbers inside the RigidBody object.

edit: Just tried doing the same with the HelloWorld app. It looks like it's clamping the number of internal steps to 1 for stability purposes. So it correctly calculates 0.1 / 0.01666 (internal timestep) is around 6 steps, however it plays it safe and only does 1 step. You can workaround this by setting the maxSubSteps parameter to 0, although you may lose something in "simulation quality".

HTH
Post Reply