Hi,
I’m using the latest version at git.
I add some lines and a cube in the scene, the hover camera looking at the cube. The cube is moving, the camera is panning. 5 seconds later, all line segments disappear, including the lines in Trident object. How did that happen? Any ideas to fix it?
Thanks.
btw, sorry for my poor english.
The code:
package
{
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.controllers.HoverController;
import away3d.debug.AwayStats;
import away3d.debug.Trident;
import away3d.entities.Mesh;
import away3d.entities.SegmentSet;
import away3d.materials.ColorMaterial;
import away3d.primitives.CubeGeometry;
import away3d.primitives.LineSegment;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Vector3D;
[SWF(backgroundColor="#000000", frameRate="30", width="1000", height="500")]
public class CurveTest extends Sprite
{
protected var __scene:Scene3D;
protected var __camera:Camera3D;
protected var __view:View3D;
protected var __cameraController:HoverController;
private var __cube:Mesh;
public function CurveTest()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
initEngine();
initObjects();
initListeners();
}
private function initEngine():void
{
__scene=new Scene3D();
__camera=new Camera3D();
__camera.lens.far=20000;
__view=new View3D();
__view.antiAlias=4;
__view.scene=__scene;
__view.camera=__camera;
__cameraController = new HoverController(__camera, null, 0, 15, 1000, 0, 90);
this.addChild(__view);
this.addChild(new AwayStats(__view));
}
private function initListeners():void
{
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function initObjects():void
{
__scene.addChild(new Trident());
__cube=new Mesh(new CubeGeometry, new ColorMaterial(0xFF0000, .8));
__scene.addChild(__cube);
__cameraController.lookAtObject=__cube;
var lineSet:SegmentSet=new SegmentSet();
__scene.addChild(lineSet);
var i:int=50;
while(i--)
{
var color:uint=uint("0x"+(Math.random()*0xffffff).toString(16));
lineSet.addSegment(new LineSegment(getRandomVector3D(), getRandomVector3D(), color, color));
}
}
private function enterFrameHandler(event:Event):void
{
__view.render();
__cameraController.panAngle++;
__cube.x+=3;
__cube.z+=3;
}
private function getRandomVector3D():Vector3D
{
return new Vector3D(Math.random()*5000-2500, Math.random()*5000-2500, Math.random()*5000-2500);
}
}
}