Hey Ive been trying to do an isometric grid in away3d but for some
reason the lines on my grid are being clipped not sure how I can fix
it..
package {
import away3d.cameras.HoverCamera3D;
import away3d.cameras.lenses.OrthogonalLens;
import away3d.containers.View3D;
import away3d.core.base.Object3D;
import away3d.core.clip.*;
import away3d.core.math.Number3D;
import away3d.lights.DirectionalLight3D;
import away3d.primitives.GridPlane;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageQuality;
import flash.events.Event;
public class Mingle extends View3D {
private var _running:Boolean = false;
private var planeX:GridPlane;
public function get running():Boolean { return
_running; }
public function set running(value:Boolean):void
{ if (value)
{ start(); } else { stop(); } }
public function start():void {
if (!_running) {
_running = true;
stage.addEventListener
(Event.ENTER_FRAME, oef);
}
}
public function stop():void {
if (_running) {
_running = false;
stage.removeEventListener
(Event.ENTER_FRAME, oef);
}
}
public function
addObject(object3d:Object3D):void { scene.addChild
(object3d); }
private function oef(e:Event):void { render(); }
private function center(e:Event = null):void {
x = stage.stageWidth *.5;
y = stage.stageHeight *.5;
clipping.minX = -x;
clipping.minY = -y;
clipping.maxX =
stage.stageWidth;
clipping.maxY =
stage.stageHeight;
}
private function init(e:Event):void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode =
StageScaleMode.NO_SCALE;
stage.quality = StageQuality.LOW;
removeEventListener(Event.ADDED_TO_STAGE, init);
//clipping = new
FrustumClipping({minZ:10});
camera = new HoverCamera3D({zoom:10});
camera.lens = new OrthogonalLens();
camera.position = new Number3D(1000, 1000,
1000);
camera.lookAt(new Number3D(0, 0, 0));
var light:DirectionalLight3D = new
DirectionalLight3D();
light.position = new Number3D(1000,
1000, 1000);
light.color = 0xFFFFFF;
light.specular = 0;
light.diffuse = 0.5;
light.ambient = 0.25;
scene.addChild(light);
planeX = new
GridPlane({width:5000,height:5000,segmentsW:
10,segmentsH:10,material:"#black"});
scene.addChild(planeX);
stage.addEventListener(Event.RESIZE, center);
center();
running = true;
}
public function Mingle() {
super();
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
}