Jump to content
  • Advertisement
Sign in to follow this  
deadstar

Quick vector question - confusion with a line from Newton's character controller

This topic is 3430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm implementing my own character controller using Newton Archimedia, and I'm reading through other character controllers for some research. These lines in Newton's character controller has me stumped, it's from a section that calculates turn torque from a target heading:
//calculate the turn angle and omega
dVector heading (dCos (m_heading), 0.0f, dSin (m_heading), 0.0f);
turnAngle = min (max ((bodyMatrix.m_front * heading).m_y, -1.0f), 1.0f);

The dVector's constructor takes X, Y, Z, and W. In the first line, Y is initialised to 0.0f. On the second line, the vector is multiplied by the matrix's Forward vector, and the resulting Y value is taken for the TurnAngle. But Y will always be 0... no? The character controller itself works fine (I've compiled using this code), but this has confused me to no end. I'd be very grateful if someone could clear this up, as I thought my maths was actually progressing well until now :P

Share this post


Link to post
Share on other sites
Advertisement
I am guessing `*' means the cross product. In that case, and if bodyMatrix.m_front is also in the XZ plane, the code is measuring the sine of the angle between bodyMatrix.m_front and heading.

Share this post


Link to post
Share on other sites
Quote:
Original post by alvaro
I am guessing `*' means the cross product. In that case, and if bodyMatrix.m_front is also in the XZ plane, the code is measuring the sine of the angle between bodyMatrix.m_front and heading.


Ahh of course! I wish people wouldn't use * and % for Cross and Dot...

Thanks for your help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!