Gaining more control over my clouds

I have created some clouds for my 2D game, and i want to make them float on the background slowly from the one side to the other. Then when they are out of view, i want to reset them and make make them float back into view.

Here is a random example of how they can look:

To create my clouds, i am using a particle emitter, renderer and animator. They are set to one-shot btw, and spawn at random places when the game starts
By setting a velocity on them, i can make them float, however when the ‘energy’ has been depleted, they reset regardless of if i want them to or not.

Can i programatically move these clouds about?
Of course i tried to programmatically move the GameObject that they are attached to, but the clouds (particles) do not follow this object and stay at their original position.

I’ve been looking around about how others did it, and had a peek at several reference materials, but i’m still unsure of how to do it. So it would be nice if someone could point me in the right direction.

Thanks for your help in advance, and let me know if i can provide some more details! :slight_smile:

You just need to turn off the Simulate In World Space option on the particle emitter to get the particles to move along with the GameObject.

Wonderfully simple! It did the trick brilliantly! :smile: I did misinterpret the meaning of “Simulate in world space”, and presumed it ment something slightly different, so im glad you pointed me on it, tnx!

For completeness of the thread, i will be able to check the position of the cloud with something like the code below:

void OnDrawGizmosSelected()
{
    Gizmos.color = Color.red;
        
    Vector3 minX = renderer.bounds.center - new Vector3(renderer.bounds.extents.x, 0);
    Vector3 maxX = renderer.bounds.center + new Vector3(renderer.bounds.extents.x, 0);
    Gizmos.DrawLine(minX, maxX);
    Vector3 screenPos = Camera.main.WorldToScreenPoint(minX);
    //print("Cloud is " + screenPos.x + " pixels from the left");
}