Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Heavy

I'm trying to figure out how to make my character's not 'floaty' when using the Box2D plugin. I've tried adding 'angularDamping: 0.01' to my main player entity, as well as adding it to the entity.js for the box2d plugin itself.

I still can't seem to get it to do anything. Friction seems to slow me down, which is what I want, but I've read on some other Box2D forum posts that for a top-down view game which is what I'm making, that I want to use angular and linear dampening. Problem is, I can't seem to figure out where to put the options to get it to take effect. Any help is most appreicated.

1 decade ago by quidmonkey

In your player entity, you can set both linear & angular damping like so:

this.body.m_linearDamping = 1; //or other value
this.body.m_angularDamping = 1; //or other value

Linear Damping slows your movement; angular slows your spin. Set either to 0 to disable damping.

1 decade ago by alexandre

@Heavy
Beware that Box2D friction is only used when b2bodies are in contact, e.g., ball body rolling down inclined body slows to a stop if friction is high enough. In other words, friction is not applied to bodies on the move unless they are in contact with others. Linear damping is indeed what you need to simulate world contact friction.
Page 1 of 1
« first « previous next › last »