I have cooked up a quick example and full source available for download on
my site for all to use.

http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/index.php?aid=118&index=3&subindex=3

Happy coding

D



On 16 July 2010 15:08, joebass <[email protected]> wrote:

> Plus, it looks cool!
>
> On Jul 16, 9:25 am, Michael Iv <[email protected]> wrote:
> > nice solution , no trig needed :)
> >
> > On Fri, Jul 16, 2010 at 4:17 PM, Darcey Lloyd <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> > > In with view.render(); I set camera.lookat(new Number3D(0,0,0));
> >
> > > Then from MouseEvent3D took stageX,stageY,stageZ scaled the normal of
> this
> > > and tweenlite the cam x,y,z to the scaled normal x,y,z, the lookat in
> with
> > > render() handles the lookat.
> >
> > > code snippets:
> >
> > > //
> > >
> ---------------------------------------------------------------------------­-----------------------------------
> > > private function render(e:Event=null):void
> > > {
> > > // keep camera looking at center of sphere
> > > camera.lookAt( new Number3D(0,0,0) );
> > >  view.render();
> > > }
> > > //
> > >
> ---------------------------------------------------------------------------­-----------------------------------
> >
> > > some code inside main.as/mxml
> > > //
> > >
> ---------------------------------------------------------------------------­-----------------------------------
> >
> > > // Set location of click target primitive (not added to view)
> > > clickTargetPrimitive.x = e.sceneX;
> > > clickTargetPrimitive.y = e.sceneY;
> > > clickTargetPrimitive.z = e.sceneZ;
> >
> > > // Set center cube to look at clickTargetPrimitive
> > > centerCube.lookAt(clickTargetPrimitive.position);
> >
> > > // Tween camera to scaled face normal of clickTargetPrimitive
> > > var camTarget:Number3D = new Number3D();
> > > camTarget.scale(clickTargetPrimitive.position,0.3);
> > > camTarget.add(camTarget,clickTargetPrimitive.position);
> > >  TweenLite.to( camera, 4, {
> > > x:camTarget.x,
> > > y:camTarget.y,
> > > z:camTarget.z,
> > >  onComplete:rotationComplete
> > > });
> >
> > > //
> > >
> ---------------------------------------------------------------------------­-----------------------------------
> > > private function rotationComplete():void
> > > {
> > > // doesn't do anything once set at start of script
> > > stage.quality = StageQuality.BEST;
> > > }
> > > //
> > >
> ---------------------------------------------------------------------------­-----------------------------------
> >
> > > On 16 July 2010 13:25, Michael Iv <[email protected]> wrote:
> >
> > >> VERY NICE!!!!, Eventually what approach used for translating the
> camera ?
> >
> > >> On Fri, Jul 16, 2010 at 3:20 PM, Darcey Lloyd <[email protected]
> >wrote:
> >
> > >>> Here is the dev test so far:
> >
> > >>>http://www.allforthecode.co.uk/development/away3d/sphere_dev<
> http://www.allforthecode.co.uk/development/away3d/sphere_dev/index.html>
> >
> > >>> Still needs work but getting there, it now has:
> >
> > >>> - Rotation on drag - dead zone 40px on x and y
> > >>> - Click rotate look at target using camera3D
> > >>> - Click target sceneXYZ face normal for cube tween to location
> > >>> - Owncanvas glow
> > >>> - Sphere with transparent placement png for cloud rotation
> >
> > >>> nice little cpu killer, reload if the materials don't fully load,
> found
> > >>> this to be a tad unpredictable.
> >
> > >>> Next up, put it all in a container, do the same with the container to
> > >>> allow items added to the surface of the sphere to be rotated instead
> of just
> > >>> the spheres... lol   I didn't think of this while building it doh :p
> >
> > >>> <
> http://www.allforthecode.co.uk/development/away3d/sphere_dev/index.html>
> >
> > >>> On 13 July 2010 10:57, Michael Iv <[email protected]> wrote:
> >
> > >>>> With some vector+ trig  magic you can manage it. I would draw a
> normal
> > >>>> from the point of the sphere where clicked  then scale that point to
> the
> > >>>> same distance as that of the camera from the sphere and then tween
> the
> > >>>> camera to that position.Would not use HoverCamera though , just the
> regular
> > >>>> one.
> >
> > >>>> On Tue, Jul 13, 2010 at 3:08 AM, Darcey Lloyd <
> [email protected]>wrote:
> >
> > >>>>> I am leaning towards getting rid of it also ;)
> >
> > >>>>> I think I will just rotate the sphere on mouse click and drag which
> > >>>>> should save any translation, easier & quicker.
> >
> > >>>>> D
> >
> > >>>>> On 13 July 2010 00:53, Peter Kapelyan <[email protected]> wrote:
> >
> > >>>>>> Super!
> >
> > >>>>>> Would I be a meanie if I said forget Hovercam? It's because I
> don't
> > >>>>>> use it, and it's easy to get any working with the regular cam,
> plus it seems
> > >>>>>> its giving you unneeded problems already.
> >
> > >>>>>> Maybe try the regular one? If you need help, let me know.
> >
> > >>>>>> -Pete
> >
> > >>>>>> On Mon, Jul 12, 2010 at 7:27 PM, Darcey Lloyd <
> [email protected]
> > >>>>>> > wrote:
> >
> > >>>>>>> Nice one Peter, I didn't think of that lol... Had target objects
> > >>>>>>> created from vertices, sceneX,Y,Z etc etc but didn't do that lol
> >
> > >>>>>>> I have updated url using your suggestion... Just don't drag
> rotate
> > >>>>>>> the sphere or it's chaos.
> >
> > >>>>>>>
> http://www.allforthecode.co.uk/development/away3d/lookat_point_on_sph...
> >
> > >>>>>>> <
> http://www.allforthecode.co.uk/development/away3d/lookat_point_on_sph...>
> > >>>>>>> Now to:
> >
> > >>>>>>> 1. Work out if possible to prevent HoverCamera3D from zooming
> away
> > >>>>>>> from the object when looking at the top or bottom.
> >
> > >>>>>>> 2. Work out translation of click location with HoverCamera3D pan
> and
> > >>>>>>> tilt angles.
> >
> > >>>>>>> Thanks
> >
> > >>>>>>> Darcey
> >
> > >>>>>>> On 13 July 2010 00:01, Peter Kapelyan <[email protected]>
> wrote:
> >
> > >>>>>>>> If you placed an object in the middle of the Sphere, and told
> that
> > >>>>>>>> object to lookAt the position where you clicked, shouldn't that
> object have
> > >>>>>>>> the correct rotation? Not sure, but seems like it should work.
> >
> > >>>>>>>> -Pete
> >
> > >>>>>>>> On Mon, Jul 12, 2010 at 6:55 PM, Darcey Lloyd <
> > >>>>>>>> [email protected]> wrote:
> >
> > >>>>>>>>> Hi,
> >
> > >>>>>>>>> I am trying to work out how to look at a point clicked on a
> sphere.
> >
> > >>>>>>>>> Here is where I am at so far:
> >
> > >>>>>>>>>
> http://www.allforthecode.co.uk/development/away3d/lookat_point_on_sph...
> >
> > >>>>>>>>> From what I gather I have two options:
> >
> > >>>>>>>>> 1. Move the cameras position and look at an object created at
> the
> > >>>>>>>>> point
> >
> > >>>>>>>>> or
> >
> > >>>>>>>>> 2. Rotate the sphere
> >
> > >>>>>>>>> The problems I am having are:
> >
> > >>>>>>>>> 1. The HoverCamera3D appears to have its position locked it's
> x,y,z
> > >>>>>>>>> cannot be modified.. or can it? I tried slapping TweenLite on
> its x,y,z
> > >>>>>>>>> properties and nothing happened.
> >
> > >>>>>>>>> 2. The HoverCamera3D tends to zoom out when looking at the top
> and
> > >>>>>>>>> bottom of the sphere which makes me think the best way to do
> this would be
> > >>>>>>>>> to rotate the sphere to prevent the object distance change.
> >
> > >>>>>>>>> 3. Rotating the sphere using MouseEvent3D.sceneX,sceneY,sceneZ
> (the
> > >>>>>>>>> point of click) to face the camera, I appear to be getting it
> look at 1 side
> > >>>>>>>>> of the sphere only.
> >
> > >>>>>>>>> 4. I have also tried using some pythag to calculate the angle I
> > >>>>>>>>> need to rotate the sphere to look at the camera but using
> > >>>>>>>>> sceneX,sceneY,sceneZ doesn't appear to give me the values I
> need to work
> > >>>>>>>>> with? or do they?
> >
> > >>>>>>>>> Any ideas on the best way to find the angle I need to rotate a
> > >>>>>>>>> sphere from it's click point? sceneX,sceneY,sceneZ to look at
> the camera?
> >
> > >>>>>>>>> Any ideas on the best way to go about this?
> >
> > >>>>>>>>> Thanks
> >
> > >>>>>>>>> Darcey
> >
> > >>>>>>>> --
> > >>>>>>>> ___________________
> >
> > >>>>>>>> Actionscript 3.0 Flash 3D Graphics Engine
> >
> > >>>>>>>> HTTP://AWAY3D.COM
> >
> > >>>>>> --
> > >>>>>> ___________________
> >
> > >>>>>> Actionscript 3.0 Flash 3D Graphics Engine
> >
> > >>>>>> HTTP://AWAY3D.COM
> >
> > >>>> --
> > >>>> Michael Ivanov ,Programmer
> > >>>> Neurotech Solutions Ltd.
> > >>>> Flex|Air |3D|Unity|
> > >>>>www.neurotechresearch.com
> > >>>>http://blog.alladvanced.net
> > >>>>http://www.meetup.com/GO3D-Games-Opensource-3D/
> > >>>> Tel:054-4962254
> > >>>> [email protected]
> > >>>> [email protected]
> >
> > >> --
> > >> Michael Ivanov ,Programmer
> > >> Neurotech Solutions Ltd.
> > >> Flex|Air |3D|Unity|
> > >>www.neurotechresearch.com
> > >>http://blog.alladvanced.net
> > >>http://www.meetup.com/GO3D-Games-Opensource-3D/
> > >> Tel:054-4962254
> > >> [email protected]
> > >> [email protected]
> >
> > --
> > Michael Ivanov ,Programmer
> > Neurotech Solutions Ltd.
> > Flex|Air
> |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://
> www.meetup.com/GO3D-Games-Opensource-3D/
> > Tel:054-4962254
> > [email protected]
> > [email protected] Hide quoted text -
> >
> > - Show quoted text -

Reply via email to