[Papervision3D] flying camera around
John Grden
neoriley at gmail.com
Tue Jun 12 00:30:16 EDT 2007
I like no extra math hacks!!
Here's the base code:
// body is the sphere object, dummy is an empty DisplayObject3D
body.lookAt(dummy);
// targetPanel is a Plane in orbit around the sphere
var planeVector = new Number3D( targetPanel.x, targetPanel.y, targetPanel.z);
var len = planeVector.modulo + 1//viewingDistance;
planeVector.normalize();
m_objAnimationManager.addEventListener(AnimationEvent.CHANGE,
handleDummyAnimationChange);
m_objAnimationManager.property(dummy, "x", planeVector.x*len, 2000,
Transitions.CUBIC_OUT, RenderMethod.TIMER);
m_objAnimationManager.property(dummy, "y", planeVector.y*len, 2000,
Transitions.CUBIC_OUT, RenderMethod.TIMER);
m_objAnimationManager.property(dummy, "z", planeVector.z*len, 2000,
Transitions.CUBIC_OUT, RenderMethod.TIMER);
private function handleDummyAnimationChange(e:AnimationEvent):void
{
body.lookAt(dummy);
}
then, when that's complete, and the sphere is now fixed on the targetPanel,
I use the same principles to animate the camera TO the panel and back 800
clicks.
var planeVector = new Number3D( targetPanel.x, targetPanel.y, targetPanel.z);
var len = planeVector.modulo + 800;
planeVector.normalize();
hth,
John
On 6/12/07, Peter Kapelyan <flashnine at gmail.com> wrote:
>
> So you will have code to share soon ? :)
> Any chance you can use "my" :) approach as a hack - since - there is no
> extra math :) I am betting on my method because the math is already in
> premade functions...so anyone can use it as quick hack but I am also
> wondering if it is faster in general.
>
> -Pete
>
>
> On 6/12/07, John Grden <neoriley at gmail.com> wrote:
> >
> > thanks Peter - it's a pretty interesting approach!
> >
> > I was actually able to do it with James' solution very well and use a
> > dummy 3D object for both the sphere and the camera. Works great now ;)
> >
> > PS> I'm trying out Ryan Taylor's AS3 Boostworthy animation system for
> > this one. So far I'm digging it and the api - (So nice to have auto
> > complete --sooooooo nice). I'm going to play with the virtual timeline in
> > the morning, and I think it might turn out pretty cool with how it looks in
> > code (how readable the timeline / sequence is in code)
> >
> > On 6/12/07, Peter Kapelyan <flashnine at gmail.com > wrote:
> > >
> > > Hey dude I thought about your idea...if you wanted to use it for you -
> > > here is how....
> > >
> > > You already placed items on the sphere..now
> > >
> > > 1. Place camera at those items and copy the rotations to the object.
> > > (xyz and rots)
> > > 2. Look at the center, and MoveBackwards. Which would in effect look
> > > directly at the plane.
> > >
> > > Lets say you want to tween the camera - you would probably do it like
> > > this:
> > >
> > > Before you perform tween place camera like step 1 above - now perform
> > > the tween to move the camera to next object, hopefully with just tweening
> > > Y?rot..(unless you find a way with tweener etc)
> > >
> > > Then move backwards with step 2...although you shouldn't have to
> > > lookat at that point because hopefully you perform the correct rotation from
> > > the object that was clicked...
> > >
> > > Hope this didn't sound like a bunch of hogwash :) it seems liek there
> > > is always a simple solution without using math when it comes to camera...
> > >
> > > -Pete
> > >
> > >
> > > On 6/11/07, John Grden <neoriley at gmail.com> wrote:
> > > >
> > > > HA very cool Peter! so simple and I love it ;) I'mma try James
> > > > theory tonight and see how that goes and give yours a whirl as well
> > > >
> > > > Thanks man!
> > > >
> > > > On 6/11/07, Peter Kapelyan <flashnine at gmail.com > wrote:
> > > > >
> > > > > Hey I did this - want to see my code or you want me to hook up
> > > > > your code?
> > > > > Also posted easy version here:
> > > > > http://www.flashnine.com/?p=23
> > > > > -Pete
> > > > >
> > > > >
> > > > > On 6/11/07, John Grden <neoriley at gmail.com > wrote:
> > > > > >
> > > > > > I wonder if anyone's done something like this:
> > > > > >
> > > > > > 1. generated random planes around a sphere
> > > > > > 2. told those planes to look at the sphere
> > > > > > [ that part works fine ;) ]
> > > > > > 3. Flown a free camera around the outside of those planes to a
> > > > > > specified plane and had it look at the plane with the same rotation (IE:,
> > > > > > like the flickr example we saw a while ago, but flying around a sphere?)
> > > > > >
> > > > > > Here's snapshot of what I'm working with. Imagine being able to
> > > > > > specify any of those planes, and have the camera animate around the outside,
> > > > > > then reposition itself infront of the plane fully rotated to match the plane
> > > > > >
> > > > > >
> > > > > > Anyone?
> > > > > >
> > > > > > I've created a "dummy" displayObject3D to copy the new panel's
> > > > > > transform, then move back 500 - then I'm trying to fly to this new position
> > > > > > where the dummy is. So, I have the "where to fly" down, just need some help
> > > > > > flying in a radius / 360 I guess ;) Not totally sure.
> > > > > >
> > > > > > I've been trying to get the scene just to rotate and re-orient
> > > > > > itself to the camera position (opposite the sphere's rotation values) and
> > > > > > that's not working as I would hoped.
> > > > > >
> > > > > > --
> > > > > > [ JPG ]
> > > > > > _______________________________________________
> > > > > > Papervision3D mailing list
> > > > > > Papervision3D at osflash.org
> > > > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Papervision3D mailing list
> > > > > Papervision3D at osflash.org
> > > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > [ JPG ]
> > > > _______________________________________________
> > > > Papervision3D mailing list
> > > > Papervision3D at osflash.org
> > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > >
> > > >
> > >
> > > _______________________________________________
> > > Papervision3D mailing list
> > > Papervision3D at osflash.org
> > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > >
> > >
> >
> >
> > --
> > [ JPG ]
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
--
[ JPG ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070612/694ebc20/attachment.htm
More information about the Papervision3D
mailing list