Camera rotation based on sphere rotation

Hi everybody!

I have a sphere which is in constant rotation (same axis, same speed) like a planet. My camera is a RTS camera (free). When I click on my sphere, my camera is grab, locked on it. When I pan, I can do the whole tour of it at same distance to the sphere.

But, my problem is, I would like my camera to follow the same rotation (speed and direction) that my sphere, like a geostationary satellite around a planet.

Actually, I can do this (incomplete) workaround with this script, but only if the camera is aligned with the sphere axis…

https://puu.sh/xIwA6/8f49b771b0.jpg

Where CameraRotationSpeed float variable is the sphere rotation speed.
My camera is composed of a scene, a sphere (used for pan), a spring arm (used for zoom) and a camera.

Thank you very much for help! :slight_smile:

Create a camera blueprint for each Planet. Attach it as a child actor component.(Solves axis and rotational alignment issues.)

When a planet is selected:
Make sure camera is not on other side of world, if so add 180 degrees to get it within view:
Get Forward Vector(self) → dot ← Get Forward Vector( Planetary Camera child actor → Camera Component)
if <0 add local rotation to sphere
set view target with blend to the child actor. Enable input on child actor to control panning.

Upon leaving a planet:
Move Celestial camera above planetary camera(to prevent the blend from going through the planet):
Get Local Location of Camera → Multiply by 2 → Add planet world location → Set Celestial world location
Blend back while disabling planetary camera input.

Thank you very much Strom!
Your vision of things (a camera per sphere + switching) and your explanations allowed me to succeed what I was looking for! :slight_smile: