[Papervision3D] Peter Kapelyan: Moving camera in Ninja Demo

Peter Kapelyan flashnine at gmail.com
Sun Jul 1 14:09:14 EDT 2007


It can be done many ways,
I tried first with one onject (for a game), then with two.
Obviously my case is specific because I needed it for a game.
If all you need is to look at two objects smooth the code is simpler.
If you need three objects - harder? etc..
I can try to explian here - but if that is not good enough I'll need to know
more what you want to do or just do it for you :)

#1 need to add some null objects - nulls help control the camera behind the
scenes

#2 If you just want to look at two (more) objects - first make sure you
lookAt something that is in the exact middle of them. For instance (with
two):
   ZcenterZ.x=(NinjAX.x+NinjA.x)/2;
   ZcenterZ.y=mainYVAR;//locks Y but can be like above...
   ZcenterZ.z=(NinjAX.z+NinjA.z)/2;

#3 Now you have to look at that object but from a 90 degree angle
(ALWAYS!!!) , and moveBackwards enough to see both with a NULL, then finally
tween the camera into that null.
Other wise instead of the null looking at the center - you can use camera if
you don't want smoothing/tweened movment)...

#4 Use Tweener or a simple smooth function between the null your camera...or
in any fasion to create a smooth motion somthing easy? like=

camera.x-=(camera.x-Zcamm.x)/9;//Zcamm is my null
camera.y-=((camera.y-Zcamm.y)/9);
camera.z-=(camera.z-Zcamm.z)/9;

where 9 is how smooth it moves= 1 should stick to object or something like
120 would take forever to get to the null :)

Hope any of this makes sense....or helps!
-pete





On 7/1/07, laurent <laurent at logiquefloue.org> wrote:
>
>
> It can be more clear perhaps.
> I looked in your panorama code, will get the movethecam() first. Then
> it's the idea of always having some object in the view of the cam that
> interest me.
>
> thx
> L
>
>
> laurent a écrit :
> > Hey Peter,
> >
> > I'm trying my first none tutorial scene in PV, that needs some smooth
> > camera movement.
> > Zeh's bezier tweener lib sounds the tool to use as soon as possible to
> > master it.
> > But perhaps there's a simple way to have one camera always showing the
> > scene as in your Ninja Demo, perhaps I can use the tween class mixed
> > with your code to have that camera movement.
> >
> > Can you make a piece of code available or the path to a tutorial about
> > this basic camera movement ?
> >
> > thank you!
> > Laurent
> >
> >
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070701/bdd7c68b/attachment.htm


More information about the Papervision3D mailing list