how to make orbital camera

edited January 18 in General Discussions
Hello,

Anyone can tell me how to make orbital camera (like in my other project ). I know there is some orbital camera in Camera Free Mode but I want to try to make my own. No need code need just explanation how can I make one in raylib (I tried to manipulate with camera.position/target but with no luck).


P.S. this video not about camera :)

Thank you!

Comments

  • The recommended way to create an orbital camera (or any other rotation in 3d) is using quaternions. Using quaternions you can calculate the rotation of a point (camera.position) around and arbitrary axis (axis defined by camera.target), that way you obtain the change with time of camera.position.

    Actually, raylib internal camera uses Euler angles for rotations and that's not the best solution, it should be rewritten to use quaternions in a future.
  • ok, will try to do as you say. thank you raysan5!
  • Hello guys. need some help with quaternions :tired_face: . First of all I'm totally newbie in C and quaternions so please don't laugh at me :). What I doing now getting 2 quaternions from axis angle (camera target and camera position) then I multiply these two quaternions. I not sure what next, I tried QuaternionToEuler and apllied to camera position, but no luck so far. Here is my messy code https://pastebin.com/rvGCfiNV
    One more thing not sure how to calculate angle which is needed to quaternion.

    Any help is appreciated. Thank you
  • Hi swipis, quaternions is not a simple topic... sorry... I could not be of much help...
Sign In or Register to comment.