constant player movement

Official forum for the Chipmunk2D Physics Library.
Predator106
Posts: 24
Joined: Sat Apr 27, 2013 10:02 am
Contact:

Re: constant player movement

Post by Predator106 »

indeed, as usual you're absolutely correct ;)

So now i got horizontal movement to work properly...but if I make the player jump by providing an impulse vertically, the player does jump but there is no air control.

I don't see why that wouldn't work. So the movement only works when his feet are on the ground. But the friction with the air should be 0 so..weird.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: constant player movement

Post by slembcke »

So surface velocity makes the physics think the surface of shape is moving separately from it's rigid body. Think like a conveyor belt. It doesn't change shape, but it's surface moves. For your player, the overall player shape doesn't change, but the feet would be moving. Same idea.

Now, when the player is in the air, it's not in contact with anything and therefor no friction force to accelerated (or decelerate) the player's movement. If you look at the second link I posted earlier, I handle air control separately. You could calculate a force for it, but since you are already in the velocity integration callback it's easier to just integrate it yourself and apply a small change to the velocity.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests