Jump to content


- - - - -

ODE character movement


  • You cannot reply to this topic
No replies to this topic

#1 tobeythorn

    Valued Member

  • Members
  • PipPipPip
  • 189 posts

Posted 23 September 2007 - 02:47 PM

I'm having a bitch of a time implementing character movement with ODE in OGRE.

Basically what I'm doing is every frame pushing the character capsule linearly based on controller input, and I throw in a -velocity*dragcoef term.

Additional, and this is where I'm having buggy behavior, I'm calculating the signed angle between the x-z velocity vector and the x-z normal vector of the character using a dot product for absolute angle, and cross product to determine sign. I treat this angle like a spring distance and add in a angular velocity damping term. I add this in as a torque in order to make sure the character turns in the direction she/he is moving.

I get jittery effect like the spring isn't damping completely, even when my angle becomes very small.

Problems I've had to correct thus far are that using acos craps out if an imprecision makes the value slightly greater than +/-1. Also, I have to guesstimate when the velocity is close enough to zero length to be affected by imprecision. I've tried setting my calculated angle to zero if the angle is small, but I'm still having jitters. Also, when I collide with a ramp or small step, the capsule tends to slide to the side, or penetrates the object.

If you have any solutions, or a better way of doing this, I would be thrilled.

-Thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users