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

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

## 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
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 on other sites
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 on other sites
Quote:
 Original post by alvaroI 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...

1. 1
2. 2
Rutin
17
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633735
• Total Posts
3013596
×