Game Development Community

TGEA 1.7.0 BUG & FIX: Free Look

by Kevin Keathley · in Torque Game Engine Advanced · 04/23/2008 (10:44 pm) · 1 replies

While messing around with 3rd person view mode in TGEA, I noticed that there was a bug with freelook (defaulting to holding the Z key in either 3rd or 1st person mode). It would jitter while trying to turn the head and then reset the body accordingly (which it wasn't supposed to do). I delved into the code and noticed this in
Player.cpp
UpdateMove(const Move * move):

GameConnection* con = getControllingClient();
if (move->freeLook && (( isMounted() && getMountNode() == 0) || (con && !con->isFirstPerson())))
{
mHead.z = mClampF(mHead.z + y,
-mDataBlock->maxFreelookAngle,
mDataBlock->maxFreelookAngle);
}
else
{
mRot.z += y;
// Rotate the head back to the front, center horizontal
// as well if we're controlling another object.
mHead.z *= 0.5f;
if (mControlObject)
mHead.x *= 0.5f;
}

It looked like it should work, at first, but it didn't. I then sat through the code and thought out the logic and realized there may be a precedence error here. I changed part of the above code to:

if (move->freeLook && (( (isMounted() && getMountNode()) == 0) || (con && !con->isFirstPerson())))

and it appeared to work. I believe a bang (!) before isMounted() make work as well. It appeared to be checking if isMounted() was true AND getMountNode() == 0 instead of isMounted() AND getMountNode() were both 0. This appeared to work, and now I have free look in 1st person and 3rd person POV. However, I can't say what effect it has when mounted now as I don't have a test case setup.

I hope this helps and if someone finds something wrong with that then feel free to chime in. Being a Guild Wars fan, i was actually implementing an incremental zoom from 3rd person POV with the middle mouse wheel (I changed the Z button to a toggle so it didn't have to be held down) and went on to try the free look. I also tried the free look on a stock demo and it wasn't working.

BTW< this is my first bug report here, so I hope I posted it in an acceptable manner.. I didn't see this anywhere else and a search only turned up other resources for adding it to previous versions, not the one that was built in..

Enjoy..