_hoverCam.panAngle = 0.5* (stage.mouseX - _lastMouseX) + _lastPanAngle;
_hoverCam.tiltAngle = 0.5*(stage.mouseY - _lastMouseY) + _lastTiltAngle;
///////////
_lastMouseX
_lastMouseY
_lastPanAngle
_lastTiltAngle
are the values stored from the last stage press.You use then in order to
process next interaction smoothly when you click in the viewport again to
interact.
you set them in on mouse click even handler:
private function onMouseDown(e:MouseEvent):void
{
_lastPanAngle = _hoverCam.panAngle;
_lastTiltAngle = _hoverCam.tiltAngle;
_lastMouseX = stage.mouseX;
_lastMouseY = stage.mouseY;
}
This was a quick into to AS3 :)) But usually you will get here mostly Away3D
oriented answers.
On Tue, Jul 13, 2010 at 12:27 AM, Kaarigar <[email protected]> wrote:
> I am totally new to ActionScript as well as Away3D - so pardon me if
> my questions sounds silly. I am learning this from the latest book
> Flash in 3D.
>
> I am trying to rotate my model by changing the panAngle and tiltAngle
> of the HoverCamera3D. Eventually my purpose is to use mouse to rotate
> the model in 3d. This is how I am doing this:
>
> override protected function CreateCamera():void
> {
> m_pHoverCamera = new HoverCamera3D();
> m_pHoverCamera.distance = 2000;
> m_pHoverCamera.tiltAngle = 0;
> m_pHoverCamera.panAngle = 0;
> m_pHoverCamera.steps = 0;
> m_pHoverCamera.yfactor = 1;
> m_pHoverCamera.wrapPanAngle = true;
> m_pView.camera = m_pHoverCamera;
> }
>
> protected override function onEnterFrame(ev : Event) : void
> {
> m_pHoverCamera.tiltAngle += 0.5;
> //m_pHoverCamera.panAngle += 0.5;
> trace(m_pHoverCamera.tiltAngle,
> m_pHoverCamera.panAngle);
> m_pHoverCamera.hover();
> m_pView.render();
> }
>
> What I am observing is that the tiltAngle does not increase beyond
> value 90 - I think its range is -90 to 90. The panAngle on the other
> hand behaves as expected. The question is how can I effectively rotate
> the model freely in 3D space?
>
> Any comments is highly appreciated. Thank you!
--
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Air |3D|Unity|
www.neurotechresearch.com
http://blog.alladvanced.net
http://www.meetup.com/GO3D-Games-Opensource-3D/
Tel:054-4962254
[email protected]
[email protected]