SetParticleType

Introduced

1.0

Description

Sets the specified ParticleType for the specified Particle.

Scripting Syntax

SetParticleType( Target, Source )

Parameters

Parameter

Type

Description

Target

ParticleType

Component on which the particle type will be set

Source

ParticleType

Particle Type to be set

Examples

VBScript Example

'
'  This example demonstrates how to set a new particle type on an existing 
'  emitter using the SetParticleType command
'

NewScene , false

' Set up a disc emitting particles
set pcloud = CreateParticleCloud( , "Disc" )(0)

' Set up goals for both PTypes
set goal4OrigPType = CreatePrim( "Grid", "MeshSurface", "thing1" )
Translate goal4OrigPType, 30, 30, 5 
Rotate goal4OrigPType, 0, 0, -90 

set goal4PEmitter = CreatePrim( "Grid", "MeshSurface", "thing2" )
Translate goal4PEmitter, -30, 30, -5 
Rotate goal4PEmitter, 0, 0, 90 

' Set up a goal for the original PType (and color the particles
' fuscia for this particle type so it's obvious which type is which)
set myPType = pcloud.ActivePrimitive.ParticleTypes(0)
myPType.Parameters( "Green" ).Value = 0.072
AddParticleGoal myPType, goal4OrigPType 

' Set up the event on the original particle type
AddParticleEvent myPType, , myPEventColl
set myPEvent = myPEventColl(0)
myPEvent.Name = "PEvent_Demo"
myPEvent.Parameters( "EventTrigger" ).Value = 5
myPEvent.Parameters( "TriggerValue" ).Value = 7
myPEvent.Parameters( "EventAction" ).Value = 0

' Set up the emitter for the event
CreateEventSource myPEvent, myPEmission
myPEmission.Parameters( "Rate" ).Value = 5
myPEmission.Parameters( "Spread" ).Value = 25
myPEmission.Parameters( "Roll" ).Value = 12
myPEmission.Parameters( "Yaw" ).Value = 7

' Set up a new blob particle type that will be emitted and set
' the new particles to flee from the goal
for each connectPType2Emitter in myPEmission.NestedObjects
   if connectPType2Emitter.Name = "PType" then
       exit for
   end if
next
CreateParticleType siBlobType, myNewPType
myNewPType.Name = "PType4Emitter"
SetParticleType connectPType2Emitter, myNewPType 
AddParticleGoal myNewPType, goal4PEmitter 

' Now take a look at the simulation
set myViewPort = Application.Desktop.ActiveLayout.Views( "vm" )
myViewPort.SetAttributeValue "layout", "maximize:b" 
FrameAll
PlayForwardsFromStart

See Also

CreateParticleType

Particle

ParticleType

ParticleCloud

ParticleCloudPrimitive

 

 

 



Autodesk Softimage v7.5