Camera rotation request
by Tim Doty · in Torque Game Builder · 04/16/2005 (2:02 pm) · 43 replies
As far as I can tell there is no way to rotate the camera in T2D. All objects could be mounted to a single invisible object and rotated to achieve the effect except that this would interfere with object movement.
Just suggesting this as a possible feature.
Just suggesting this as a possible feature.
About the author
#2
04/24/2005 (10:26 am)
Thanks for the info. I completely understand it not ranking high on your list.
#3
The main thing I'm wanting it for is for styles of games where the player stays stationary, and the world rotates around. Some driving games do this I think, or the old coinop Assault is a good example.
06/29/2005 (11:03 pm)
I'll second this request. I just encountered this today... I was assuming that I'd be able to do it, and was dissapointed when I found out you couldn't.The main thing I'm wanting it for is for styles of games where the player stays stationary, and the world rotates around. Some driving games do this I think, or the old coinop Assault is a good example.
#4
Any update on this? I really need to rotate the camera in a prototype I'm putting together. If this is off the list of things that will get added, any hints on where I should start messing to get it working?
02/23/2006 (4:18 pm)
Old post, I know. Just figured I post here instead of starting a new thread.Any update on this? I really need to rotate the camera in a prototype I'm putting together. If this is off the list of things that will get added, any hints on where I should start messing to get it working?
#5
02/27/2006 (6:00 am)
Okay, I have a "hack" in place that seem to work for my purposes so far. It would still be nice to know if there will ever be a proper solution to this, especially since the t2d product page says "Camera rotation, mounting, zoom". *hint, hint* =)
#6
03/01/2006 (8:31 pm)
Can you share that hack? I'm assuming it requires modification to the source code ?? I'd like a way to simply rotate the camera 90 degrees to the left or right...
#7
In t2dSceneWindow::onRender() just above dglSetViewport(updateRect); add:
change t2dTileLayer::getCollisionAreaPhysics() to:
and t2dTileLayer::renderObject() to:
Then the really messy part that absolutely shouldn't be done this way... It's ugly as hell, but, hey, it works. For now. =)
In t2dTileLayer::renderArbitraryAngleObject() just below viewPortMax = (viewPort.point + viewPort.extent);
You have to add functions to set the mCameraAngle to t2dSceneWindow too, but that should be pretty straight forwards, just do whatever is done to the zoom variable.
03/01/2006 (8:59 pm)
Well, it's a pretty horrible hack but it works okay for my purposes. It can be optimized quite a lot, especially if you only need 90 degree rotations.In t2dSceneWindow::onRender() just above dglSetViewport(updateRect); add:
// blikstad: translate to 0,0,0, rotate, translate back. t2dVector camPos = getCurrentCameraPosition(); glTranslatef(camPos.mX, camPos.mY, 0); glRotatef (mCameraCurrent.mCameraAngle,0,0,1); glTranslatef(-camPos.mX, -camPos.mY, 0); //
change t2dTileLayer::getCollisionAreaPhysics() to:
// Choose Appropriate Render Method. // blikstad: Always render tileMaps with the renderArbitraryAngleObject function to allow for rotating camera. // Arbitrary Angle. return getCollisionAreaPhysics_ArbitraryAngle( worldArea );
and t2dTileLayer::renderObject() to:
// Ignore if not part of a scene.
if ( !getSceneGraph() )
return;
// Choose Appropriate Render Method.
// blikstad: Always render tileMaps with the renderArbitraryAngleObject function to allow for rotating camera.
// Arbitrary Angle.
renderArbitraryAngleObject( viewPort, viewIntersection );Then the really messy part that absolutely shouldn't be done this way... It's ugly as hell, but, hey, it works. For now. =)
In t2dTileLayer::renderArbitraryAngleObject() just below viewPortMax = (viewPort.point + viewPort.extent);
// // blikstad: Extend viewPortMin and Max a bit to make sure all tiles in view get // drawn. Yes, the values are hardcoded, and this yes is a damn ugly hack. // Bleh, I don't care. It works. t2dVector viewPortResize(15,25); viewPortMin -= viewPortResize; viewPortMax += viewPortResize; //
You have to add functions to set the mCameraAngle to t2dSceneWindow too, but that should be pretty straight forwards, just do whatever is done to the zoom variable.
#8
03/01/2006 (11:29 pm)
Cool, thanks for the code snips :) I'll give this a try once I get vc2005 Express installed!
#9
03/22/2006 (6:57 am)
Is this still planned to be added? Would be cool indeed. Imagine a 360
#10
04/18/2006 (4:50 pm)
Yea, I 'd also like to know if this is still in the works. It's not just a neat effect, it's something that helps break away from the standard 2d game look (IMHO).
#11
04/19/2006 (12:23 pm)
T2D has so many cool features that Rotate Camera feels odd not to have :)
#12
10/20/2006 (10:45 am)
I added free rotation to my game. It works well but some objects at the corners don't get drawn for some reason. I guess it has something to do with viewPortResize but I don't have a clue what to change there. Can anyone help?
#13
11/27/2006 (1:05 am)
I suppose this is the place to post a second/third/etc for camera rotation, and/or the ability to mount the camera to an object and track the rotation there, too.
#14
11/27/2006 (5:46 pm)
How did you add rotation Olli?
#15
11/28/2006 (3:02 am)
I added the code from Magnus Blikstad's post. If I remember right I didn't have to do anything else.
#16
~John Lucas~
01/22/2007 (4:20 pm)
I would also really make use of this feature. I expected it when I bought the engine, but I'll try out Magnus Blikstad's code before I start to beg.~John Lucas~
#17
/raises both hands if it can optionally track an object's rotation when mounted.
04/02/2007 (10:54 pm)
/raises hand for camera rotation/raises both hands if it can optionally track an object's rotation when mounted.
#18
Cheers
Tom
05/31/2007 (8:57 am)
Is camera rotation still not implemented? If it is how do you get it to work? (its not tracking the roation of the sprite at the moment).Cheers
Tom
#19
07/15/2007 (9:08 am)
*bump* has anyone tried the code snippet up above in TGB Pro 1.5.0? My hand is still raised for camera rotation capability...
#20
I will try implementing the above code in my tgb (1.6), though I also request this become a standard feature...here are 2 examples where it would come in handy:
#1 A game like 'punishment' in which the entire room rotates without changing any of the game state
#2 A different way of viewing the standard asteroids/subspace game in which your ship always looks straight ahead
01/12/2008 (12:15 am)
*bump* I thought for sure I'd be able to mount the camera and 'track rotation' like a regular mounted object, but unfortunately the scenewindow2d doesn't have that functionality in the mount function...I will try implementing the above code in my tgb (1.6), though I also request this become a standard feature...here are 2 examples where it would come in handy:
#1 A game like 'punishment' in which the entire room rotates without changing any of the game state
#2 A different way of viewing the standard asteroids/subspace game in which your ship always looks straight ahead
Associate Melv May
- Melv.