Hi,

I'm trying to spin around a 3d Cube using a HoverCamera, should be
simple right!? :o

But when it comes to the top or the bottom of the cube, the camera
flips round all of a sudden..

check it out -
www.funkyjunk.me.uk/imagesForExternals/away3d/cube/index.html
(the problem is more apparent on the bottom of the cube "OB". The top
just acts really odd)

Here is the code I'm using...

private function MouseDown(e:MouseEvent3D):void
{
        cameraRegister();
        _mouseDownFlag = true;
        stage.addEventListener(MouseEvent.MOUSE_UP,childUpOutside);
}

private function childUpOutside (event:MouseEvent):void
{
   stage.removeEventListener(MouseEvent.MOUSE_UP, childUpOutside);
   _mouseDownFlag = false;
}

private function MouseUp(e:MouseEvent3D):void
{
        _mouseDownFlag = false;
}

public function cameraRegister():void {
        _lastPanAngle = this.panAngle;
        _lastTiltAngle = this.tiltAngle;
        _lastMouseX = this.mouseX;
        _lastMouseY = this.mouseY;
}

private function onEnterFrame(event : Event) : void
{
        if (_mouseDownFlag) cameraRender()
        _camera.hover();
        _view.render();
}

public function cameraRender():void
{
        var cameraSpeed:Number = 0.7;
        _camera.panAngle = cameraSpeed * (this.mouseX - _lastMouseX) +
_lastPanAngle;
        _camera.tiltAngle = cameraSpeed * (this.mouseY - _lastMouseY) +
_lastTiltAngle;

}

Many thanks!!! :)

Reply via email to