RotateAround a cylinder,but produced some wrong offset

i make a gameObject as parent gameObject ,called “aircraft”, it has a child empty gameObject ,called “controller”,the controller has a child gameObject ,called “body”,the body is 3D model of the aircraft, when game start ,the parent gameObject aircraft move to forward, and i write a script control the aircraft orbit around a cylinder,and the script attach to “controller”.

i use RotateAround function to control the “controller” gameObject

myTransform.RotateAround(Vector3.zero,Vector3(0,0,-Input.GetAxis("Horizontal")),rotateSpeed);

parent gameObject “aircraft” move to forward

pTransform.Translate(Vector3.forward * mySpeed * Time.deltaTime);

when game start,everything is normal,like this

10217-a.jpg

but after a while, when the aircraft rotate back on the top of cylinder,some thing is wrong,aircraft not in the center of the cylinder,like this

10216-2.png

i don’t know why, need help

My guess is that the point you are using for your rotate around is not orthogonal to the position of the plane. Try changing your setup. Place an empty game object on the axis of the cylinder. Make the plane a child of the empty game object at the start position above. Move and rotate the ship by moving and rotating the empty game object (Transform.Rotate()). That way the point of rotation and the position of the ship will be aligned.