Move object from A to B on sphere

Hi there,

I basically need to make a spaceship fly from point A to point B on a planets surface (or at a certain altitude).
I’ve tried looking into RotateAround, but it’s really strict not really what I was looking for.

What I’m looking for is:

  • Rotate around earth (placed in at a radius of 4975.
  • Move from point A to point B on the surface of earth, no slerp/lerp.
  • Parent needs to LookAt target, point b (Only rotate around Z-axis).
  • Child already has a script to make it LookAt

The ships gameobject consists of a parent called “Interceptor”. A child of “Interceptor” called “ShipLookatZero”, this basically only rotates it’s child “ShipModel” so the ships bottom always faces

The variables I’m thinking would be great here is:

var startPoint : Transform;
var endPoint : Transform;
var shipSpeed : float;

Could the awesome Unity community help me out here?

I think for the most part you want to make your ship a child of an ‘anchor’ object, just a transform at the position you would like to rotate around, in this case the center of the planet. Then you can just set the ships local position so it is the proper distance away from the anchor, preferably down the forward axis so then you can just have the anchor LookAt the point you want the ship to go and it will end up there.

Hmm I don’t really know to set it up correctly.
This is what I apply to the child of the anchor.


var startPoint : Transform;
var endPoint : Transform;
var shipSpeed : float;

function Start () {
	transform.position = startPoint.position;

function Update () {
	transform.localPosition.x = transform.localPosition.x - Time.deltaTime * shipSpeed;

Here’s a screenshot of the parent tree and the inspector of the child of the Zero anchor:

And here’s the unity file if anyone can take a look at it and point out what the issue is:

I really wish I knew how to do this.