Cursor Aim/static movement issue
by Deadhead5888 · in Torque Game Engine · 03/02/2009 (8:28 am) · 2 replies
Im trying to do a isometric/top down game. I would like to get the camera locked on my character have the character's rotation relative to the position of the mouse and just use 1 up button to make the character move in said direction again rotation relative to the mouse's position.
Im very new to torque and not the best programmer but im trying with little success. If anyone has any suggestions or links to other threads that might have the information i can use(havnt found one yet)
Thanks and have a great day :)
Im very new to torque and not the best programmer but im trying with little success. If anyone has any suggestions or links to other threads that might have the information i can use(havnt found one yet)
Thanks and have a great day :)
#2
http://www.garagegames.com/community/forums/viewthread/84433
For movement relative to the camera, heres a little snippet that should help you. Its not technically relative to the camera, but it will work as long as your camera is not rotated on the Z axis. Go to player.cpp and look in updateMove.
03/08/2009 (7:12 am)
Check out this thread, it shows an example of how to manipulate the camera position and rotations. http://www.garagegames.com/community/forums/viewthread/84433
For movement relative to the camera, heres a little snippet that should help you. Its not technically relative to the camera, but it will work as long as your camera is not rotated on the Z axis. Go to player.cpp and look in updateMove.
if (mState == MoveState && mDamageState == Enabled)
{
if(!(getTypeMask() & AIObjectType)){
moveVec = VectorF(1*move->x,1*move->y,0);
}
else{
zRot.getColumn(0,&moveVec);
moveVec *= move->x;
VectorF tv;
zRot.getColumn(1,&tv);
moveVec += tv * move->y;
}
Torque Owner Timothy Castagna
TK Games LLC
http://www.garagegames.com/community/blogs/view/16305