I have an object thats rotated so its facing down towards the ground. The object itself is rotating around a planet, like the moon in orbit, so the rotation is fixed around. Im trying to make it so that this fixed initial rotation thats pointing of the ground of this object, always stays at that angle as it rotates around the rotational axis. However I also want it to constantly face away from the rotational axis throughout the whole orbit. Thanks in advance!!
RotateAround sounds like what you are looking for, something like,
public Transform centre;
void Update () {
transform.RotateAround(centre.position, Vector3.up, 20 * Time.deltaTime);
}
That will keep the object this script is attached to rotating around the centre object. It will retain its relative angle to the centre object, so that it is always facing away from it for example.