Pregunta

In Unity I can handle circular motion around an object with a simple

transform.RotateAround(GameObject.Find("CubeTest").transform.position, Vector3.up, 20000*Time.deltaTime);

However, I want the object traveling in circular motion to approach this object whilst in orbit. Not entirely sure how to do this without screwing up.

¿Fue útil?

Solución

GameObject cube = GameObject.Find("CubeTest");    
transform.LookAt(cube.transform);
transform.Translate(transform.forward * Time.deltaTime * approachSpeed);
transform.RotateAround(cube.transform.position, Vector3.up,20000*Time.deltaTime);

I think that could do as you want? It moves towards the rotation point gradually, then rotates, giving the appearance of a deteriorating orbit.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top