Let's Build This...
Click a blue box, and emit a burst of yellow particles from a red sphere.
1. Create the Scene:
- Draw a box, right click to exit draw mode, make it blue.
- Draw a sphere, right click to exit draw mode, make it red.
- Draw a particle emitter to emit yellow particles. Draw it directly on the surface of the red sphere by clicking . Right Click to exit draw-mode.
- 'Child' the Particle emitter to the sphere in the hierarchy. This will come in handy later.
- In the hierarchy panel click and drag the words 'ParticleEmitter' onto the words 'SphereEntity' until there's pink outline around SphereEntity then release. This make ParticleEmitter a child of SphereEntity; wherever the parent goes so will go the child.
- Set the particle emitter's particle color to yellow.
- ParticleMaterial > Diffuse > Color to yellow.
- Set the Particle Emitter's Continuous > Pulse property to "none".
- In the Particle Emitter's property panel select the top-level object 'ParticleEmitter'.
- Now in the right pane of the property editor select 'none' on the Continuous > Pulse Property.
2. Make the Blue Box "Interactable"
- Add the 'Interactable' attribute to the blue box.
- Select the blue box (in the space or hierarchy)
- Reveal the property editor panel
- On the top level of the object, (top left of property panel where you see the word "BoxEntity" next to an icon) press the little 'add attribute' triangle in a circle button, and select +Interactable.
- Add the Interactable attribute (one of the more exciting attributes... as attributes go.)
3. Create an OnPress Event:
- Select the newly-added Interactable attribute and in the right pane select onPress() from the list.
The Scripting Editor window will appear and it'll put you right where you need to be to tell Simmetri what to do when you press the blue cube.
4. Create emitBurst Script via Drag and Drop of Emitter Icon:
- Drag the ParticleEmitter icon from the hierarchy onto the script window in an empty line between the first line beginning with the word 'function' and the last line containing only 'end.'
- This will place the words ParticleEmitter = findObject... followed by a unique ID string.
- This long Unique ID or "UID" is specific to this particular particle emitter in this space in this Simmetri show/universe. Its like a social security number, only one per citizen.
- This line, with this find and UID statement lets us speak to and from the Particle Emitter.
- We're going to call a function on this particle emitter called emitBurst()
function MeshEntity:onPress(seg, normal, anchor_node) ParticleEmitter = findObjectByUid("16UJDTYCFJC9K1K31DZDDRICG4/12TCQKKB6XV8O18TNXG44TF81T") ParticleEmitter:emitBurst(400) end
5. In Play-Time or Present-Time Click on the Box to Emit Burst
Challenge: Can You Take It To the Next Level?
Add a Physics Impulse Emitter to Surge the Sphere in the Direction Opposite the Yellow Blast Travels.
HINT 1: Impulses will draw in a way where they push against the surface you draw them on. And as they're drawn, they automatically become a child of the object you draw them on.
HINT 2: You'll want the physics impulse emitter to have no continuous pulse.
HINT 3: A physics impulse emitter has a function called emit() as opposed to emitBurst(). And no number is passed into the function between the parentheses.
Now turn off gravity.