Reversing Torque To Move in the Other Direction

Official forum for the Chipmunk2D Physics Library.
Post Reply
zacware
Posts: 5
Joined: Sun Sep 27, 2009 5:25 pm
Contact:

Reversing Torque To Move in the Other Direction

Post by zacware »

OK, surely a stupid question, as I'm new to chipmunk and haven't touched physics since college, but I've just finished my first game on the iphone using ChipMunk, and the one problem I'm having is having my car move LESS realistically.

I'm apply torque to the front and rear wheels, which have spring and pin joints attaching them to the body, and the car moves great, but when the user wants to go in the opposite direction, the car is slowing down first and then slowly accelerating in the opposite direction.

In the real world, this is how it would be, but this is a game, so I'm trying to get a less realistic response and have the car move in the opposite direction more quickly.

I've tried applying a temporary large negative torque in the opposite direction, but the wheels jump off the car in a ragdoll like fashion

I searched for what I assumed would be a common question, but it appears not to be the case. anyone have any pointers on this for a newbie?
mobilebros
Posts: 90
Joined: Tue Aug 04, 2009 9:53 am
Contact:

Re: Reversing Torque To Move in the Other Direction

Post by mobilebros »

I had a similar issue, I wanted to slow down a user controlled ball quickly if the opposite direction was desired. I ended up setting the horizontal velocity and angular velocity manually. In my game loop I detected the direction changed then did something like this:

Code: Select all

		body->v = cpv((body->v.x*0.75),body->v.y);
		body->w = body->w*0.75;
zacware
Posts: 5
Joined: Sun Sep 27, 2009 5:25 pm
Contact:

Re: Reversing Torque To Move in the Other Direction

Post by zacware »

Thanks! I'll try that!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 11 guests