I am trying to make a sphere spin on its axis (like a planet does). Atm, I’m not worried about making the axis offset like in reality. The prefab is 3 spheres. 1 is parent, and is the “planet”, and the other 2 are children of that 1 sphere and are “clouds”, which are nothing more that slightly larger spheres with a cloud texture and transparency set up on them. It looks good, and the script makes the planet spin just fine. However, the clouds don’t spin at all. And I’ve been searching for hours on how to get the children to have their own spin rates independent of the planet, or even to “inherit” the planets spin. But so far the planet just spins under a stationary cloud-cover. Any help would be great. Also, you can feel free to ignore/delete my code from line 6 to 16 rather than trying to fix it - if needs be. I would be fine with deleting it and putting in all new code since it doesn’t work anyway, and I’m not even sure if I’m on the right track with it.
Oddly, when i run the game and click on the (clone) planet and look at its children… based on the numbers changing in the transform section - they are actually rotating - its just the texture that is on them seems to be stuck and is not rotating with them.
Also, if you couldn’t tell, I’m quite new at this.
public void Setup()
{
rb = pInstance.GetComponent<Rigidbody>();
rb.angularVelocity = Vector3.up * (rotateSpeed / -20);
if (transform.childCount > 0)
{
foreach (Transform child in transform)
{
Rigidbody tempRB = child.GetComponent<Rigidbody>();
if (tempRB != null)
{
tempRB.angularVelocity = Vector3.up * (rotateSpeed / -20);
}
}
}
}