A Fun Tutorial Blending Physics and Color:
In this project we learn how to make a movable ball leave behind a trail of tracer balls, each a color representing the movable ball's speed at that point in space / time.
Video Tutorial on How to Build "Velocity Color Tracers"
What you'll learn:
- Working with Speed via script: Linear velocity magnitude
- Components of velocity: velocity in the Y direction
- "Moving": emit my sample object when the emitter moves.
- "Clone as 'copy' ": clone the item I emit as a full copy with its own set of properties, not sharing properties with the source of the clone.
- onEmit() event / function: The onEmit() function happens right before the emitter emits the objectd and gives you a chance to change properties on the emitted object.
- Hue Saturation Brightness.
- How to use hsb() to set color in script
- Working with linear velocity.
- Working with hue saturation and brightness for changing color in script.
- Print statement.
- Movable Ball Actor:
- Setting properties to give the ball more power and change maximum speed.
- Basic Construction:
- Basic object hierarchy work
Script Used in this Tutorial:
function NodeEmitter:onEmit(obj) vel = self:getParentNode():getRigidBody():getLinearVelocity():length() --print(tostring(vel)) obj.color = hsb( ( 180 + (vel*10)) ,1,1) end