RTS camera trouble

Blitz3D Forums/Blitz3D Beginners Area/RTS camera trouble

BLaBZ(Posted 2007) [#1]
Im trying to make a rts like game and im having trouble with the camera movement.
The camera starts off looking down at an angle at the map. Every time i move it on the z axis it ends up getting closer to the map(terrain).
I want to keep it facing the map at an angle but maintain its distance from the map.
Thanks a lot
ben


b32(Posted 2007) [#2]
Can't you move it in XY instead ? Else, turn the camera before renderworld, then after it, turn it back.
Another way might be using TranslateEntity instead.


jfk EO-11110(Posted 2007) [#3]
you want to maintain its distance from the map, but it should not get closer to the map????

Man, is it me or was this kind of contradicting? Anyway, I think you want to lower and rise the camera without to alter the angle, right? Then use TranslateENtity instead of Moveentity!


Mattizzle(Posted 2007) [#4]
Actually, lol he wants to keep the same distance between the map and the camera and allow the player to move the view over the map... that would be moving the camera in it's global x and z coords. So, yes TranslateEntity is what you should use:
TranslateEntity camera, KeyDown(205)-KeyDown(203), 0, KeyDown(200)-KeyDown(208)


But if you want the camera to be able to rotate and move left and right / forward and back relative to its current yaw rotation, you would need to use a CreatePivot() and parent the camera to your pivot. Thus, applying your x and z movement to the pivot and rotation to the camera.

Thank you, thank you, ladies and gentalmen, thank you....


BLaBZ(Posted 2007) [#5]
Perfect thanks a lot. Translate was exactly what i was looking for.