wandPosition Examples: Throwing Paper Airplanes

This example uses the wand position as the start point for an animation. Whenever you press button 1, a paper airplane launches from your hand.


/*
	throwing a paper airplane using the wandPosition node
	
	when button 1 is pressed, move the airplane to the 
	wand's position and start the animation to make it fly.
*/


#include "User0"

light (position (1 -1 1))
light (position (-1 -1 -1),diffuse(.5 .5 .5))

wandPosition(volume(infinite),
	when(button1,flightStartPoint.position($xpos $ypos $zpos),
	flightTimer.start))

timer flightTimer (duration(10),when(changed,flightpath.set($value)))

transform flightStartPoint ()
{
	pointFollower flightpath (path(flight.path))
	{
		object (file(paperairplane.b3d))
	}
}

The path file, flight.path:

0 0 0

5 5 10
3 10 8
-5 15 5
0 20 0

paperairplane.b3d


(c) Ben Chang