[Physics] Applying Force Constantly - Gravity?

Hi all,

I'm really not an expert on physics engine in general so I hope I'm missing something obvious.

I have scenario where I have to simulate a vehicle driven on a surface that climbs up and down. I've been playing around with the physics API but the only way I could apply contant force to the non-static body was through Gravity. body:applyForce or body:applyLinearImpulse( ) didn't help as their application is instantaneous. I've also tried to frequently apply force using body:applyForce (something like every 50ms) but the result was a constantly flipping vehicle :) or a static one because it couldn't climb a hill.

So, if you could point me to the right direction with regards to what I'm trying to achieve it would be greatly appreciated.


Hm.. Have you any Screenshots?
Why not using the traditional attempt and move the objects in an enterFrame?

Thanks for the prompt suggestion. But, if I'm not mistaken, this mean that the path should be well known. In this case, I'd rather not deal with that. Am I missing something?

Ahh. I guess now I get your Problem. So you want a 2D SideScroller where you have hills and a car (let's say like tinywings or BikeBaron (just without the 3D)).

If that's the case, I would suggest using body:applyLinearImpulse( ).
Then you can apply a linear impulse in the direction the car is facing atm!
Just put the body:applyLinearImpulse( ) into the enterframe and use very low values!

Hmm... I'll give it a try with low values. I'm also planning to increase the friction of the ground for the downhill run so that the vehicle won't pick up too much speed.

Thanks ;)

views:1286 update:2011/11/25 8:45:21
corona forums © 2003-2011