Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Box2D Physics question about velocity

Author
Message
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 21st Aug 2011 18:51 Edited at: 21st Aug 2011 19:35
This is for a Ludum Dare project, so time is of the essence.

I have an object moving along, and it turns.

I want to dampen it's speed in the direction it WAS going. Right now it has a nice sliding motion, but it's sliding a little to much. I want to dampen the effects of velocity when the sprite is moving sideways without detracting from it's forward motion in the direction it's pointing.

Any ideas? I've messed with the Physics commands a lot, but I'm having trouble piecing together how to make it behave like a car.

Here's a video to get a better idea. I just want it to change direction a little faster.



Doz
16
Years of Service
User Offline
Joined: 16th Apr 2008
Location:
Posted: 21st Aug 2011 19:52
It seems like you need a friction level with the road, I'm not sure if its possible to add though and get the full effect, because you would want a higher friction value for the lateral motion and less for in line. I guess if you kept track of some inertia vector along with the acceleration vector and when they don't line up apply a higher friction between the car and the road?

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 21st Aug 2011 20:38
I managed to find a reasonable solution (at least for the Ludum Dare contest entry) by increasing the value of SetSpritePhysicsDamping().

Using that means increasing the applied force for movement, but it seems to be giving a close approximation to what I was after.

Login to post a reply

Server time is: 2024-04-23 14:21:50
Your offset time is: 2024-04-23 14:21:50