Object Hierarchy | Related C++ Class: ParticleCloud | Supported Parameter List: cloud
Inheritance
SIObject
ProjectItem
SceneItem
X3DObject
ParticleCloud
Description
The ParticleCloud object is a kind of X3DObject that represents a cloud of Particle objects. The data representing the particles is managed by the ParticleCloudPrimitive object. The ParticleCloud object has only one primitive which can be accessed via either: X3DObject.ActivePrimitive or X3DObject.Primitives(0).
Methods
|
|
|
Properties
Examples
VBScript Example
'
' This example demonstrates how it is possible to find the forces, emitters and
' particle types that influence a cloud via the construction history
'
Option Explicit
NewScene , false
dim myParticleCloud, myParticleEmitter, myParticleEmitter2
dim myForce, myForce2
' First we create a complex cloud which is influenced by two forces and which
' emits two different particle types from two different grids.
set myParticleCloud = CreateParticleCloud
set myParticleEmitter = CreatePrim( "Grid", "MeshSurface", "ParticleEmitter" )
set myParticleEmitter2 = CreatePrim( "Grid", "MeshSurface", "ParticleEmitter2" )
Translate myParticleEmitter2,,-4,,siRelative,siView,siObj,siY
AddParticleEmitter myParticleCloud, myParticleEmitter
AddParticleEmitter myParticleCloud, myParticleEmitter2
set myForce = CreateForce( "Gravity" )
AddParticleForce myParticleCloud, myForce
set myForce2 = CreateForce( "Attractor" )
AddParticleForce myParticleCloud, myForce2
dim strNewType
CreateParticleType siBlobType, strNewType
SetParticleType myParticleEmitter2 & ".ParticleEmitter2_emission.PType", strNewType
'
' Now that the scene is set up, demonstrate how to find these objects again
'
' Find the ParticleOp operator.
' Note: There could be several operators in the Construction history,
' for example if there are any scripted operators on the cloud
dim myCloudParticleOp, Op
set myCloudParticleOp = Nothing
set myParticleCloud = ActiveSceneRoot.Children( "cloud" )
for each Op in myParticleCloud.ActivePrimitive.ConstructionHistory
if ( Op.Name = "ParticlesOp" ) then
set myCloudParticleOp = Op
exit for
end if
next
if ( TypeName( myCloudParticleOp ) <> "Nothing" ) then
' The particle operator connects to many different objects.
' By enumerating through these inputs you can find the various objects
' that are involved in the simulation
dim inputport
for each inputport in myCloudParticleOp.InputPorts
if ( inputport.Target2.Type = "ParType" ) then
Application.LogMessage "Found Particle Type: " & inputport.Target2
elseif ( inputport.Target2.Type = "EmissionProp" ) then
'The ParticlesOp connects to the ActivePrimitive of the
'the emissions object. To get to the actual X3DObject that
'is the emitter we access the parent of this primitive.
Application.LogMessage "Found Emission object: " & inputport.Target2.Parent
elseif ( inputport.Target2.Type = "gravity" ) then
Application.LogMessage "Found Gravity force: " & inputport.Target2.Parent
elseif ( inputport.Target2.Type = "attractor" ) then
Application.LogMessage "Found Attractor force: " & inputport.Target2.Parent
end if
next
else
MsgBox "Unexpected - no ParticlesOp in the cloud's construction history"
end if
'The output of running this script is this:
'INFO : "Found Emission object: ParticleEmitter"
'INFO : "Found Emission object: ParticleEmitter2"
'INFO : "Found Gravity force: gravity"
'INFO : "Found Attractor force: attractor"
'INFO : "Found Particle Type: ParTypes.PType"
'INFO : "Found Particle Type: ParTypes.PType1"
See Also
|
|
|
|
SOFTIMAGE|XSI v6.01