It is very simple Dude ! Let's say new Sphere is 130 And old SPhere is 80 so old sphere is smaller then new in% is 80*100/130
On Fri, May 21, 2010 at 6:14 PM, dyc <[email protected]> wrote: > So, I need some help getting the % the new sphere is in relation to > the "optimal" sphere which then zooms to 100px away. > > can u help me figure out the math for that? i been out of highschool > for 12 years and havent a clue.. > > I have a sphere whos radius = x > > i have an old sphere whos radius = 100 > > what % is the old sphere of the new one? > > On May 20, 3:46 pm, Fabrice3D <[email protected]> wrote: > > Another option would be to multply the boundingRadius of the new Sphere > by a factor > > that gives you a distance always in scale of the sphere. > > > > like camera.distance = myNewSphere.boundingRadius * 1.8; > > > > Fabrice > > > > On May 21, 2010, at 12:14 AM, dyc wrote: > > > > > > > > > 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} ); > -- Michael Ivanov ,Programmer Neurotech Solutions Ltd. Flex|Air |3D|Unity| www.neurotechresearch.com Tel:054-4962254 [email protected] [email protected]
