Game Development Community

Camera movement normalized after scaling in overhead mode - RESOLVED

by JANR · in Torque 3D Professional · 12/12/2009 (4:59 pm) · 10 replies

in Camera::processTick
else if(virtualMode == OverheadMode)
      {

         bool faster = move->trigger[0] || move->trigger[1];
         F32 scale = mMovementSpeed * (faster + 1);
		
         mObjToWorld.getColumn(3,&pos);
         mObjToWorld.getColumn(0,&vec);
         vec = vec * move->x * TickSec * scale +       (strafeMode ? vec * move->yaw * 2.0f * TickSec * scale : Point3F(0, 0, 0));
         vec.z = 0;
         vec.normalizeSafe();
         posVec = vec;
         mObjToWorld.getColumn(2,&vec);
         vec = vec * move->y * TickSec * scale - (strafeMode ? vec * move->pitch * 2.0f * TickSec * scale : Point3F(0, 0, 0));
         vec.z = 0;
         vec.normalizeSafe();
         posVec += vec;
         posVec.z += move->z * TickSec * scale + move->roll * TickSec * scale;

      }

The movement shouldn't be normalized after scaling.
Just remove the normalize stuff and it seems to be ok.

#1
12/12/2009 (9:55 pm)
Is this part of the RTS kit?

If it is you should probably mention somewhere. Stock T3D does not have an overhead mode.

Edit: That I know of at least... I could be crazy though.
#2
12/12/2009 (10:57 pm)
Then you're crazy :P

Here's some doc on setting it up in T3D if you're interested.

http://docs.torquepowered.com/torque-3d/official/content/documentation/Scripting/Advanced/RTSPrototype.html#Overhead_Camera

#3
12/13/2009 (1:54 am)
Yeah that's part of the RTS example. It's not stock. :)
#4
12/13/2009 (3:23 am)
Huh? you guys trying to pull my leg or something?

Before anyone else tries to say this is not stock code, check it out for yourself.

in stock, plain, vanilla, ordinary, not modified T3D 1.1 Alpha (Not TGE, not TGEA, not RTS Starter Kit, not RTS example).

\Engine\source\T3D\camera.cpp
in the function Camera::processTick

the stuff I pasted starts at line 378.

#5
12/13/2009 (4:49 am)
Just keeping you on your toes. =P
#6
12/13/2009 (9:54 am)
:)
#7
06/13/2010 (5:25 pm)
Logged as TQA-354.
#8
06/14/2010 (8:16 am)
Thanks! That was really bugging me!

Now, any idea how to fix the problem where the camera direction reverses when you tilt to look above the horizon in OverheadMode?
#9
08/25/2010 (4:43 pm)
Just removing the normalization doesn't work entirely. If you are looking down it seems to work but as your pitch goes up toward the horizon your forward motion is slowed depending on the pitch. I've got something that ALMOST works well. It maintains the proper speed unless you are looking just one degree off of the horizon then it stops all forward movement until your pitch is above or below that.
#10
09/17/2010 (4:53 pm)
Fixed in 1.1 Beta 3.