Sign in to follow this  
deadstar

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

Recommended Posts

deadstar    536
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
alvaro    21246
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
deadstar    536
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this