Laurens Posted December 24, 2009 Share Posted December 24, 2009 Hi guys, I am currently building an RTS camera and not being so great at math I am a little stuck. The camera has a certain altitude which can be adjusted by the player, let's say it's 10. The camera is rotated a certain amount on the X axis to make it look at the ground. Lets say 40 degrees. Now, when I press "W" I make it move locally on the Z-axis. This makes it move forward, but because it is rotated on the X-axis and thus having the Z-axis facing the ground, it also moves down. I need to figure out how much to move the camera up along the Y-axis for any given amount on the Z-axis (let's say 1 for arguments sake). Can anyone help me figure this out? Thanks! PS. I know I could just let the camera move down (MoveEntity) and right afterwards call PositionEntity and reposition it on the Y-axis but I prefer to do it properly. This seems like a dirty workaround. Quote Link to comment Share on other sites More sharing options...
Canardia Posted December 24, 2009 Share Posted December 24, 2009 You should make a pivot, which is not rotated, and parent the camera to that pivot. Then you can move the pivot on the plane you want with the WASD keys. 1 Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Laurens Posted December 24, 2009 Author Share Posted December 24, 2009 That did it! Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.