[C#] How rotate camera around an entity?


What is the best way to rotate a camera around an entity programmatically?

I rotate my camera by adding an empty entity (pivot) in the code, then set the camera as a child, and rotate the empty entity.
I'm away from my pc, but it would be like this:

Code: Select all

public class movement : EntityComponent { Entity camera; Entity pivot; //OnGameStart ... camera = Entity.Find("mainCamera"); pivot = Entity.Spaw...; pivot.Position = Entity.Position; camera.Parent = pivot; ... //OnUpdate //Rotate pivot... }

Who is online

Users browsing this forum: No registered users and 0 guests