パーティクル クラウドの作成

 
 
 

エミッタを作成するには、基本的に新しいポイント クラウド上で作業するシミュレート ICE ツリーの設定に使用する EmitPointsFromObject コマンドで、ベースとして使用するプリミティブを指定します。 このエミッタは、パーティクルの標準設定(寿命、サイズ、方向、質量など)を保存するために、エミッタ オブジェクトの作成、オペレータ スタックへの ICE ツリー オペレータの追加、および多くの ICE ノードとコンパウンドの追加を行います。

ツリーを設定したら、以下の構文のように SetValue コマンドを使用して個々の値を修正できます。

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

新しい基本ノードまたはコンパウンド ノードを ICE ツリーに追加するには、まず AddICENode または AddICECompoundNode を呼び出し、次に ConnectICENodes を使用して接続します。 これらのテクニックは、すべて以下の例で説明されています。

JScript の例: スクリプトを解してパーティクル システムを設定する

この例では、ディスク パーティクル エミッションを設定し、最終的に球を追加することでシミュレート ICE ツリーを変更する方法を示します。

// 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;
}