Original Post
🔒 Locked
Camera Rotation
Advertisement
i would think you need the camera to rotate around some relative point in space (e g always 10 units in front of the viewpoint) and you use the mouse to control the angulation.
i''ve never done this, but i guess the safest way would be to fix mouse coordinates at some moment (e g when the program starts or when the user clicks a mouse button), fix those coordinates to some angle of the camera and then claculate the offset as the mouse is moved:
hope this helps,
crispy
i''ve never done this, but i guess the safest way would be to fix mouse coordinates at some moment (e g when the program starts or when the user clicks a mouse button), fix those coordinates to some angle of the camera and then claculate the offset as the mouse is moved:
1) fix mouse coordinates (the zero coordinates) and set camera angle to zero
2) poll for mouse movement
3) if new mouse coordinates do not overlap the zero coordinates on eg x-axis, calculate the angle to rotate the world on some axis from the difference between the current and zero coordinates. how great an angle you calculate per every pixel the mouse has moved, depends on for example mouse sensitivity, etc.
hope this helps,
crispy
if you are using gluLookAt then write a function that uses vectors to rotate the camera a certain amount of degrees in the direction that you move the mouse. always use a point that is exactly 1 unit from the camera. You need to have done year 12 maths 2 to write this function. There are probably easier ways but that is the way that i did it
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement