Hi, I'm trying to create a body for my character, however when my character ran into a wall, he began to spin wildly in all directions. I need to make sure that he is only rotated on the Y axis, think of like a scarecrow that you could spin on his stake, but you wouldn't tilt it back. Any suggestions?
Date: 18 Aug 2010 16:26
Number of posts: 2
RSS: New posts
A couple different ways you could do this. You could create a separate constraint, that causes the body to stay upright. You could do what the example does, and set the inertia for the object to 0/identity to restrict it's rotation.
In the long run though, for characters, I find you generally want total control over the physics responses. Since for most games you dont want the character to have 'real' physics, thus I usually suggest making many of the methods on the Body class virtual, and then overriding and changing them for CharacterBodys, that way you get total control, don't want your character to have angular velocity, or rotation, don't add utilize those parts. There is a very slight perf decrease by now utilizing virtual functions, but there are so many other areas in the code that you can make up performance that it doesn't matter imo.