shawn's blog

……moar clouds (part duex)…..

Posted in Unity by Shawn on January 25, 2011

At the end of part one, we finished the easier task of making the background for our clouds and picking the object that our particle emmiter will pump out consistently. Now we’re going to have to generate clouds. This can be done by using Instantiate, which is basically create.

var instance : GameObject = Instantiate( clouds, transform.position, transform.rotation);
This will create the initial cloud object. In Unity, it’s actually quite easy to apply a piece of code to an object; it’s simply a matter of drag and drop. And unlike those cloud makers that you see on the side of the road sometimes, these cloud makers needed to be invisible. To achieve this, you can create an empty game object. You can probably achieve the same result by creating a block, then turn off the rendering, but I haven’t tested yet, and this method seems a bit more practical, with less potential errors.

I know it's the same image, but it's filled with many empty game objects.

Before adding the Instantiate function onto the game objects, I had to remember to add the cloud movement command onto the clouds, to enable movement. I could then confidently (somehow) apply the instantiate script to the game objects to spawn lovely clouds.

Spawning clouds

Now we have clouds. But they’re not very exciting, albeit, clouds may not be the most exciting thing. However, if we just had clouds spawning consistently from these locations, we would wind up with a line of clouds, which end up providing a very monotonous background of clouds.
That’s it for now. We’ll look at spawning more clouds at different rates next.
Tagged with: ,

Comments Off on ……moar clouds (part duex)…..