Im trying to wrap my head around this and it almost makes sense...can you ellaborate a little?
m, Fabrice3D <[email protected]> wrote: > Why not define a scale factor... > i mean say you make a test and define that a distance from a sphere "a" is > nice. > Then multiply the distance to center by the factor diff of the new sphere and > your original sphere "a". no? > > Fabrice > > On May 19, 2010, at 9:18 PM, dyc wrote: > > > > > Hey guys! I have a pretty complex problem, but Im sure itll be easy > > for some of you! > > > Anyways, I have this globe that you can click on the surface, and it > > places another sphere where u clicked, based on how far you dragged > > after clicking...that becomes the radius of the new smaller sphere. > > > I am zooming the camera into the sphere, but it is always a different > > size when u get zoomed up to it, because the radius is independent of > > the zooming script. What I need help on, is a way to inorporate the > > RADIUS of the new sphere into the zooming math, so that I can control > > how large the new sphere should be each time...I just want the sphere > > to be the same size every time they place a sphere and it zooms, no > > matter what the radius of the sphere is... > > > see what I mean? > > > Thanks so much!! > > > here is the code so far: > > > // New idea use bigger radius with lon/lat data > > var phi:Number = (90 - _currentLat) * Math.PI / 180; > > var theta:Number = (_currentLon) * Math.PI / 180; > > // THIS NEXT LINE IS WHERE IM TRYING TO DO THE NEW > > CURRENTSELECTEDRADIUS incporporation > > /*// EARTHRADIUS + ZOOM_DISTANCE_FROM_SURFACE is the > > distance from > > the planet to do > > // NEW WAY this is where the camera zooms to - > > integrating with > > currentSelectedRadius of sphere. > > var cameraZoomX:Number = ((EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE) * Math.sin(phi) * Math.cos(theta)) / > > currentSelectedRadius; > > var cameraZoomZ:Number = ((EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE) * Math.sin(phi) * Math.sin(theta)) / > > currentSelectedRadius; > > var cameraZoomY:Number = ((EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE) * Math.cos(phi)) / > > currentSelectedRadius;*/ > > > // OLD WAY > > var cameraZoomX:Number = (EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE) > > * Math.sin(phi) * Math.cos(theta); > > var cameraZoomZ:Number = (EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE) > > * Math.sin(phi) * Math.sin(theta); > > var cameraZoomY:Number = (EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE) > > * Math.cos(phi); > > > var tagX:Number = (EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE + 500) > > * Math.sin(phi) * Math.cos(theta); > > var tagZ:Number = (EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE + 500) > > * Math.sin(phi) * Math.sin(theta); > > var tagY:Number = (EARTHRADIUS + > > ZOOM_DISTANCE_FROM_SURFACE + 500) > > * Math.cos(phi); > > > TweenLite.to(zoomCamera, 3, { x: cameraZoomX, y: > > cameraZoomY, z: > > cameraZoomZ, ease:Expo.easeOut} );
