[Papervision3D] Camera around / following object
Javier España | javierespana.com
info at javierespana.com
Tue Jul 21 05:01:16 PDT 2009
Any ideas?
On Mon, Jul 20, 2009 at 4:44 PM, Maggical <info at javierespana.com> wrote:
>
> I tried to change this:
>
> camera.orbit(cameraPitch, cameraYaw);
>
> to this:
>
> camera.orbit(cameraPitch, cameraYaw, true, walkingDoll);
>
> and it works better, it follows the object, but it seems as the camera get
> closer to the object as it moves instead of mantaining a steady distance to
> the object... Any ideas?
>
> Thanks,
>
> Javier
>
>
> Maggical wrote:
> >
> > Hi there,
> >
> > I've managed to load an object I want to display, and have a camera that
> > is
> > controlled by the mouse movement and wheel that circles around it and
> > zooms
> > in and out... Using this:
> >
> > *Listeners:*
> >
> > stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoving);
> > stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheel);
> >
> > *Functions:*
> >
> > private function mouseWheel(event:MouseEvent):void{
> > ///
> > camera.moveForward(10 * event.delta);
> > }
> >
> > private function mouseMoving(event:MouseEvent):void{
> > ///
> > var differenceX:Number = event.stageX - previousMouseX;
> > var differenceY:Number = event.stageY - previousMouseY;
> > ///
> > cameraPitch += differenceY;
> > cameraYaw += differenceX;
> > ///
> > previousMouseX = event.stageX;
> > previousMouseY = event.stageY;
> > }
> >
> > *onEnterFrame:*
> >
> > cameraPitch %= 360;
> > cameraYaw %= 360;
> > ///
> > cameraPitch = cameraPitch > 45 ? cameraPitch : 45.0001;
> > cameraPitch = cameraPitch < 90 ? cameraPitch : 89.9999;
> > ///
> > camera.orbit(cameraPitch, cameraYaw);
> > ///
> > renderer.renderScene(scene, camera, viewport);
> >
> > -------------
> >
> > The thing is that I now added some code to be able to move the object
> > using
> > some keys... And the camera seems to be stuck on the same place and not
> > follow the object... I need the user to move the object with the keys,
> but
> > that the camera still circles the object pointing at it all the time...
> >
> > Any help? I've searched the list but couldn't find an answer that worked
> > for
> > me...
> >
> > Thanks,
> >
> > Javier
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Camera-around---following-object-tp24576151p24576249.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090721/ed1b0c4b/attachment-0001.html>
More information about the Papervision3D
mailing list