Softimage SDK Programmer's Guide > Working with the SDK > ICE Node Particles >

# Creating a Particle Cloud

You can create an emitter by specifying the primitive to use as the basis in the EmitPointsFromObject command, which basically sets up a working simulated ICE tree on the new point cloud. It takes care of creating the emitter object, adding the ICE tree operator to its operator stack, and adding a number of ICE nodes and compounds to store the standard settings for particles (age, size, direction, density, etc.).

Once the tree is set up, you can then start modifying individual values using the SetValue command with this syntax:

    <PointCloud>.<PointCloudPrimitive>.ICETree.<nodename>.<portname>

You can add new basic or compound nodes to the ICE tree by first calling AddICENode or AddICECompoundNode and then connect it with ConnectICENodes. These techniques are all documented in the following example.

## JScript Example: To set up a particle system through scripting

This example demonstrates how to set up a disc particle emission and then modify that simulated ICE tree by adding a sphere as its goal.

    // Set up the emitter
    NewScene("", false);
    var emitter = CreatePrim("Disc", "MeshSurface");
    var ptcloud = EmitPointsFromObject("disc");

    // Set up goal (make it move around a bit)
    var goal = SetMovementOnGoal();
    AddICECompoundNode("Move Towards Goal", "PointCloud.pointcloud.ICETree");
    AddPortToICENode("PointCloud.pointcloud.ICETree.port3", siNodePortDataInsertionLocationAfter);
    AddICENode("GetDataNode", "PointCloud.pointcloud.ICETree");
    ConnectICENodes("PointCloud.pointcloud.ICETree.port4", "PointCloud.pointcloud.ICETree.Move_Towards_Goal.Execute");
    SetValue("PointCloud.pointcloud.ICETree.Move_Towards_Goal.Test_Distance", 0, null);
    SetValue("PointCloud.pointcloud.ICETree.SceneReferenceNode[1].reference", "sphere", null);
    ConnectICENodes("PointCloud.pointcloud.ICETree.Move_Towards_Goal.Geometry1", "PointCloud.pointcloud.ICETree.SceneReferenceNode[1].value");

    // Test it out
    FirstFrame();
    PlayForwardsFromStart();
    FirstFrame();
    PlayForwardsFromStart();

    // Helper
    function SetMovementOnGoal()
    {
    	var sph = CreatePrim("Sphere", "NurbsSurface");
    	SetValue("sphere.sphere.radius", 1.5);
    	SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", 1, null, null, null, false);

    	SetValue("PlayControl.Key", 32);
    	SetValue("PlayControl.Current", 32);
    	Translate(sph, 6.70968113705515, 4.86256743059746, -0.486256743059746, siRelative, siView, siObj, siXYZ,
    		null, null, null, null, null, null, null, null, null, 0);
    	SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", 32, null, null, null, false);

    	SetValue("PlayControl.Key", 60);
    	SetValue("PlayControl.Current", 60);
    	Translate(sph, -14.9707336352791, 2.77860996034141, -0.277860996034141, siRelative, siView, siObj, siXYZ,
    		null, null, null, null, null, null, null, null, null, 0);
    	SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", 60, null, null, null, false);

    	SetValue("PlayControl.Key", 98);
    	SetValue("PlayControl.Current", 98);
    	Translate(sph, 1.86164563340259, -14.1631924367402, 1.41631924367402, siRelative, siView, siObj, siXYZ,
    		null, null, null, null, null, null, null, null, null, 0);
    	SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", 98, null, null, null, false);

    	StoreAction(sph, "sphere.kine.local.sclx,sphere.kine.local.scly,sphere.kine.local.sclz,sphere.kine.local.rotx,"
    		+ "sphere.kine.local.roty,sphere.kine.local.rotz,sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine"
    		+ ".local.posz,sphere.kine.global.sclx,sphere.kine.global.scly,sphere.kine.global.sclz,sphere.kine.global."
    		+ "rotx,sphere.kine.global.roty,sphere.kine.global.rotz,sphere.kine.global.posx,sphere.kine.global.posy,sp"
    		+ "here.kine.global.posz", 5, "StoredAnimAction", null, 1, 98, null, null, true, 1);

    	return sph;
    }

You can also see the ParticleOp example that shows how to write a particle operator for manipulating a particle cloud. This example is located in the examples folder of the Softimage SDK installation directory.