Modifying the Hover Drag Controller…

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 25 July 2011 01:39 AM   Total Posts: 344

Hi there, I’m trying to modify the Hover Drag Controller so that as the camera moves higher above the target object the radius of the rotaion also increases.

I’ve basically got the general motion in place, but the problem I’m having is that the radius size seems to get unsynchronised, so by scrolling up and down a few times, especially if you click and scroll up, let got and repeat, the radius gets further and further removed from what ti was originally.

You can see this in action here (FP11 Beta)

http://www.margaretscratcher.co.uk/VirtualTour/index.html

All I’ve added to achieve this is

if (camera.rotationX >= -85)
   
{
    trace 
("cam rot X " +camera.rotationX)
   
_targetRadius -= dy radSpeed;
   

in updateRotationTarget()

(radSpeed is just a factor to multiply how much the radius zooming effect occurs)

Putting the ‘if’ condition in there helped, because it meant that you didn’t continue moving away from the target once you were looking directly down on it (it seems to level out at -87 degrees or so)

The other thing is, what I’m trying to achieve is to limit the camera.y to about head height, and for this to be the point where the radius will be closest to the target, wheras at the moment you can see that by dragging down the camera goes beneath 0 and is still getting closer. basically the action needs to happen 90 degrees sooner..

I know it’s just down to some simple maths but it is driving me crazy, can anyone help?...

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X