public override void CreateScene()
{
// create a 3d line
Line3d line = new Line3d( new Vector3( 0, 0, 30 ), Vector3.UnitY, 50, ColorEx.Blue );
Triangle tri = new Triangle(
new Vector3( -25, 0, 0 ),
new Vector3( 0, 50, 0 ),
new Vector3( 25, 0, 0 ),
ColorEx.Red,
ColorEx.Blue,
ColorEx.Green );
// create a node for the line
SceneNode node = scene.RootSceneNode.CreateChildSceneNode();
SceneNode lineNode = node.CreateChildSceneNode();
SceneNode triNode = node.CreateChildSceneNode();
triNode.Position = new Vector3( 50, 0, 0 );
// add the line and triangle to the scene
lineNode.AttachObject( line );
triNode.AttachObject( tri );
// create a node rotation controller value, which will mark the specified scene node as a target of the rotation
// we want to rotate along the Y axis for the triangle and Z for the line (just for the hell of it)
NodeRotationControllerValue rotate = new NodeRotationControllerValue( triNode, Vector3.UnitY );
NodeRotationControllerValue rotate2 = new NodeRotationControllerValue( lineNode, Vector3.UnitZ );
// the multiply controller function will multiply the source controller value by the specified value each frame.
MultipyControllerFunction func = new MultipyControllerFunction( 50 );
// create a new controller, using the rotate and func objects created above. there are 2 overloads to this method. the one being
// used uses an internal FrameTimeControllerValue as the source value by default. The destination value will be the node, which
// is implemented to simply call Rotate on the specified node along the specified axis. The function will multiply the given value
// against the source value, which in this case is the current frame time. The end result in this demo is that if 50 is specified in the
// MultiplyControllerValue, then the node will rotate 50 degrees per second. since the value is scaled by the frame time, the speed
// of the rotation will be consistent on all machines regardless of CPU speed.
ControllerManager.Instance.CreateController( rotate, func );
ControllerManager.Instance.CreateController( rotate2, func );
// place the camera in an optimal position
camera.Position = new Vector3( 30, 30, 220 );
debugText = "Spinning triangle - Using custom built geometry";
}