- Home /
Question by
holymanus · Jun 21, 2021 at 09:11 AM ·
rotation3dcoordinates
3D rotation in sphere cartesian coordinates
Hello everyone,
I trying to rotate an object around other object or center in two axes.
I was trying to apply cartesian coordinates, but probably doing that wrong way.
void Update()
{
azimuth += (0.1f * Time.deltaTime);
float posX = radius * Mathf.Cos(Mathf.Rad2Deg*azimuth);
float posY = radius * Mathf.Sin(Mathf.Rad2Deg*azimuth);
transform.Translate(posX,0.0f, posY);
//transform.RotateAround(ballRotate.transform.position, Vector3.up ,360 * Time.deltaTime);
//transform.RotateAround(ballRotate.transform.position, Vector3.right, angleNumber * Time.deltaTime);
}
Im able to rotate only in one axis but my goal is to change two angles of rotation, so the object's trajectory will pass through all points of the "sphere" cartesian coordinates.
Any ideas ?
Comment