SetEventObstacle

Introduced

2.0

Description

Sets up an obstacle as part of a particle event.

Scripting Syntax

SetEventObstacle( Target, Source )

Parameters

Parameter

Type

Description

Target

Property

Event on which the obstacle will be added.

Default Value: Selected event property.

Source

X3DObject

Obstacle to add.

Default Value: Selected event property.

Examples

JScript Example

/*
   This example demonstrates how to set up an event obstacle using the SetEventObstacle command
*/
NewScene( null, false );

// Add a particle cloud with a disc emitter and use its primitive to get the particle type
var pcloud = CreateParticleCloud( "", "Disc" )(0);
var ptype = pcloud.ActivePrimitive.ParticleTypes(0);

// Add a grid that will serve as its obstacle with some animation on it that moves it
// across the x-axis (positive to negative)
var grid_obs = CreatePrim( "Grid", "MeshSurface" );
grid_obs.ulength = 4; grid_obs.vlength = 4;  // Shrink it in half
grid_obs.posy.Value = 5.0; // Translate it up in y to 5
var xvals = new Array( /*keys, values*/
          0,  5, 
          29, 2, 
          54, 0, 
          79, -3, 
          98, -7
          );
grid_obs.posx.AddFCurve2( xvals, siDefaultFCurve );

// Add an event using the grid as obstacle which will cause the particles to disappear
var pevent = AddParticleEvent( ptype )(0)(0);
pevent.Name = "PEvent_Obstacle_Demo";
SetEventObstacle( pevent, grid_obs );
pevent.Parameters("EventAction").Value = 1;

// When it plays back you can see how the particles disappear under the grid as it 
// moves across the screen
var myViewPort = Application.Desktop.ActiveLayout.Views( "vm" );
myViewPort.SetAttributeValue( "layout", "maximize:b" );
FrameAll();
PlayForwardsFromStart();

See Also

AddParticleEmitter

AddParticleForce

AddParticleObstacle

ApplyParticleShader

CreateParticleCloud

CreateParticleType

SetParticleType

Particle

ParticleType

ParticleCloud

ParticleCloudPrimitive

 



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index