This code example shows how to draw lines of different colors. All the code and assets are in the projects Scripts directory. You can download the project using the link above.
// Turn on debug so that Chat.printDebug() and Chat.dump() work Chat.debugOutput = true; // Display the stats panel in the bottom left corner of screen Application.statsVisible = true; // Turn on collisions, but allow the user to turn it off Actor.setCollisionSetting( true, false ); // Turn on gravity, but allow the user to turn it off Actor.setGravitySetting( true, false ); // Hide the avatar Actor.showAvatar = false; // Hide the chat panel Application.chatPaneVisible = false; // Set ambient light for the scene Scene.ambientLightColor = Color(0.5, 0.5, 0.5, 0); // Create a point light // var oPointLight = Scene.createPointLight( "SceneLight" ); // oPointLight.position = Vector( 0, 600, -500 ); // Create the floor var oGround = Scene.createGround( "MainFloor", "RustySteel", 3000.0, 3000.0, true ); // Create the line object oLine = Scene.createLine( "FirstLine" ); // Add 4 lines to the line object using a different color for each one oLine.addLine( Vector( 0.0, 9.6, 0.0 ), Vector( 160.0, 9.6, 0.0 ), Color( 1,0,0,0 ) ); oLine.addLine( Vector( 160.0, 9.6, 0.0 ), Vector( 160.0, 9.6, 160.0 ), Color( 0,0,1,0 ) ); oLine.addLine( Vector( 160.0, 9.6, 160.0 ), Vector( 0.0, 9.6, 160.0 ), Color( 0,1,0,0 ) ); oLine.addLine( Vector( 0.0, 9.6, 160.0 ), Vector( 0.0, 9.6, 0.0 ), Color( 1,1,1,0 ) ); // Add the line object to a scene node and set the position oLineNode = Scene.createSceneNode( "MyLineNode" ); oLineNode.attachObject( oLine ); oLineNode.position = Vector( 50, 90, -200 ); // Render the lines oLine.draw();