[Papervision3D] Camera Orbit on mouse drag
Steve D
kruass at gmail.com
Fri Jul 10 11:31:56 PDT 2009
Without even looking at your code I can tell that you're using absolute
mouse positions to determine the camera's rotation.
If you rotate the camera, release the mouse button, then click again without
moving the mouse, the camera rotates perfectly, as though nothing were wrong
with the code. Yet, if you move the mouse while the mouse button is
released, the object will "jump" when attempting to drag again from a
different mousex/y position. This indicates to me that your code is
utilizing absolute values of the mouse position rather than relative values.
In your mouseDown handler, save the x/y coordinates of the click. In your
mouseMove handler, incrementally update the rotation angles based on the
difference between the current x/y and the start of the click.
On Fri, Jul 10, 2009 at 9:33 AM, Dav <dav at funkdaweb.com> wrote:
> Hi guys,
>
> The current project I'm working on requires us to load large poly models,
> (6000 - 16000 polys) into our flash app and they need to be interactive,
> rotate, zoom etc...
>
> We need the click and drag of the scene to rotate the model, however we
> have
> noticed that rotating the model is expensive, CPU-wise. So we're trying a
> different approach. We want to orbit the camera around the model on click
> and drag.
>
> I've set up a low poly test file here:
> http://79.170.40.163/flashdev.com/MEL/
>
> Now the problem we are having is the camera orbit NOT starting from where
> you left off.
>
> For example you click and drag to rotate the model, then lift off (mouse
> up). Then move your mouse elsewhere and click and drag again to rotate
> again. The model now appears to jump to another location and rotate from
> there.
>
> How would I make it begin the second rotation from where it finished last
> time, rather than appear to jump?
>
> The source to the FlashDevelop project is zipped up here if anyone can
> help:
> http://79.170.40.163/flashdev.com/MEL/ModelViewer.zip
>
> Thanks!
> Dav
>
>
> _______________________________________________
> 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/20090710/37b015fc/attachment-0001.html>
More information about the Papervision3D
mailing list