Posted By: jaknine
Help me convert this simple camera code block? - 08/03/08 00:14
I have the following as part of my camera code:
When the user holds the right mouse button, the mouse cursor is centered in the view and the camera rotates around its own axis.
This code is being used in a modified "cameraFree01.wdl" file. The cameraFree action is assigned to a dummy entity in my level.
I would like the camera to orbit (instead of rotate) around a point in the center of the view at an arbitrary distance. I want to do this in my existing modified cameraFree code (instead of switching to cameraOrbit or something else).
How can I change the code above to do this?
Thanks!
Code:
if(mouse_right) { mouse_map=cursor_orbit; //center_cursor(); MOUSE_POS.X = (screen_size.x / 2); MOUSE_POS.Y = (screen_size.y / 2); // add mouse forces MY.skill1 -= (mickey.x*cameraFree01_mouse_force)*(time_step * 1.5); // pan MY.skill2 -= (mickey.y*cameraFree01_mouse_force)*(time_step * 1.5); // tilt }
When the user holds the right mouse button, the mouse cursor is centered in the view and the camera rotates around its own axis.
This code is being used in a modified "cameraFree01.wdl" file. The cameraFree action is assigned to a dummy entity in my level.
I would like the camera to orbit (instead of rotate) around a point in the center of the view at an arbitrary distance. I want to do this in my existing modified cameraFree code (instead of switching to cameraOrbit or something else).
How can I change the code above to do this?
Thanks!