[Papervision3D] better roation
Javier España | javierespana.com
info at javierespana.com
Tue Jul 28 04:11:09 PDT 2009
The thing that worked for me was to place the collada inside of a
DisplayObject3D, and then rotate that do3d...
Have you tried this? Let me know...
On Tue, Jul 28, 2009 at 6:55 AM, Ross Hulford <ross at welovethedesign.com>wrote:
> This my code below. This works fine, however the object can be dragged and
> then is rotated on its y axis onEnterFrame. The problem is it is not that
> smooth and have tried rotating the camera replacing
>
> collada.rotationY +=2;
>
> with
>
> camera.rotationY +=2;
>
> then the collada object disappears of screen for a while ( do I need to
> target the center of the collada with the camera?). Should i always rotate
> the camera rather than the object?
>
>
> Can someone help me
>
> (i) rotate the camera so it rotates around the center point of the collada
>
> And or
>
> (ii) use tweener to rotate the collada
>
>
>
> I would like to hear any opinions and methods you would like to suggest.
>
>
> Thanks,
>
>
> R.
>
>
>
>
> addEventListener(MouseEvent.MOUSE_DOWN,
> onMouseDown);
> addEventListener(MouseEvent.MOUSE_MOVE,
> onMouseMove);
> addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
> addEventListener(Event.ENTER_FRAME, render);
>
> function render(e:Event) {
> collada.rotationY +=2;
> renderer.renderScene(scene, camera, viewport);
>
> }
>
> function onMouseDown(event:MouseEvent):void
>
> {
> isOribiting = true;
> previousMouseX = event.stageX;
> previousMouseY = event.stageY;
> }
>
> function onMouseUp(event:MouseEvent):void
> {
> isOribiting = false;
> }
>
> function onMouseMove(event:MouseEvent):void
> {
> var differenceX:Number = event.stageX -
> previousMouseX;
> var differenceY:Number = event.stageY -
> previousMouseY;
>
> if(isOribiting)
> {
> cameraPitch += differenceY;
> cameraYaw += differenceX;
>
> cameraPitch %= 360;
> cameraYaw %= 360;
>
> cameraPitch = cameraPitch > 0 ? cameraPitch
> : 0.0001;
> cameraPitch = cameraPitch < 90 ? cameraPitch
> : 89.9999;
>
> previousMouseX = event.stageX;
> previousMouseY = event.stageY;
>
> camera.orbit(cameraPitch, cameraYaw, true,
> cameraTarget);
> }
> }
>
>
> _______________________________________________
> 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/20090728/c3c27d3c/attachment.html>
More information about the Papervision3D
mailing list