JPlane
JPlane is a geometry object.
Example
Instructions
- Import
import jiglib.geometry.JPlane;
- Declare
private var jObject :JPlane
- Initialize
jObject = new JPlane(skin)
Parameter Default Description skin NONE skin - Add
PhysicsSystem.getInstance().addBody(jObject);
Code
package { import flash.display.Sprite; import flash.events.Event; import jiglib.geometry.JPlane; import jiglib.math.JNumber3D; import jiglib.physics.PhysicsSystem; import jiglib.plugin.papervision3d.Pv3dMesh; import org.papervision3d.materials.ColorMaterial; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.materials.special.CompositeMaterial; import org.papervision3d.materials.utils.MaterialsList; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; public class JigLibFlashJPlane extends BasicView { private var material :CompositeMaterial; private var material2 :CompositeMaterial; private var material3 :CompositeMaterial; private var array :Array = new Array(); public function JigLibFlashJPlane() { super(); material = new CompositeMaterial(); material.addMaterial(new ColorMaterial(0x000000, 0.5)); material.addMaterial(new WireframeMaterial(0x000000)); material2 = new CompositeMaterial(); material2.addMaterial(new ColorMaterial(0x00ff00, 0.5)); material2.addMaterial(new WireframeMaterial(0x00ff00)); material3 = new CompositeMaterial(); material3.addMaterial(new ColorMaterial(0xff0000, 0.5)); material3.addMaterial(new WireframeMaterial(0xff0000)); for (var i:int = 0; i < 3; i++) { var object :Plane = new Plane(material, 100, 100); scene.addChild(object); var jObject :JPlane = new JPlane(new Pv3dMesh(object)); jObject.moveTo(new JNumber3D((250 * i) - 250, 0, -500)); PhysicsSystem.getInstance().addBody(jObject); } for (i = 0; i < 2; i++) { object = new Plane(material, 100, 100); scene.addChild(object); array[i] = new JPlane(new Pv3dMesh(object)); array[i].moveTo(new JNumber3D((250 * i), 100, -500)); PhysicsSystem.getInstance().addBody(array[i]); } object = new Plane(material, 100, 100); scene.addChild(object); array[2] = new JPlane(new Pv3dMesh(object)); array[2].mass = 1; array[2].movable = true; array[2].moveTo(new JNumber3D(300, 500, -500)); PhysicsSystem.getInstance().addBody(array[2]); startRendering(); } protected override function onRenderTick(e:Event=null):void { for (var i:String in array) { if (array[i].isActive()) { array[i].skin.mesh.material = material2; } else { array[i].skin.mesh.material = material3; } if (array[2].currentState.position.y < -500) { array[2].moveTo(new JNumber3D(300, 500, -500)); } } PhysicsSystem.getInstance().integrate(0.1); super.onRenderTick(e); } } }