So i’m writing out a program to lock a camera to an entity or object in my game
The rotation works fine and seems to rotate correctly but the center about which it rotates is off.
I reckon i understand why it’s not working i just don’t know how to fix it
Here’s the code
public void lockCameraToEntity(Entity e,float x,float y,float z){
float hyp = (float)Math.sqrt(x*x+z*z);
this.pos.x=(float)(-(e.pos.x+x) + (Math.sin(Math.toRadians(e.rot.y))*hyp)+hyp);
this.pos.y=-(e.pos.y+y);
this.pos.z=(float)(-(e.pos.z+z) + (Math.cos(Math.toRadians(e.rot.y))*hyp)+hyp);
}