HoverController Wrap Bug

Software: Away3D 4.x

NoseKills, Newbie
Posted: 23 May 2012 02:25 PM   Total Posts: 8

Hi

I have a 3rd person follow-cam in my game with quite a lot of “step”.

mCamControl = new HoverController(cameramLookAtObject1801715);
mCamControl.steps 32;
mCamControl.wrapPanAngle true

It rotates OK for one revolution, but after that if i keep spinning my character, whenever a full +/-360 degrees is completed, the camera quickly rotates ~360 degrees the wrong way to meet the target position from the “other direction”.

I take it this shouldn’t happen when using wrapPanAngle == true?
Not unless the current angle differs from the desired one by more than +/-180 degrees anyways (in which case rotating in the opposite direction is the fastest way to get to the right position).

Adding this to HoverController.update() fixes it for me (the last “if” is added)

if (wrapPanAngle{
 
if (_panAngle 0)
  
panAngle = (_panAngle 360) + 360;
 else
  
panAngle _panAngle 360;
     
 if (
panAngle _currentPanAngle < -180)
  
panAngle += 360;
 else if (
panAngle _currentPanAngle 180)
  
panAngle -= 360;
}
    
_currentTiltAngle 
+= (_tiltAngle _currentTiltAngle)/(steps 1);
_currentPanAngle += (_panAngle _currentPanAngle)/(steps 1);

// added by me  
if (wrapPanAngle{
 
if (_currentPanAngle 0)
 
{
  _currentPanAngle 
= (_currentPanAngle 360) + 360;
 
}
 
else
 
{
            _currentPanAngle 
_currentPanAngle 360;
 
}

The fix is just something i came up with real quick, so that’s not the issue here. Just making sure this is an issue and not just something i have misunderstood about the HoverController?!?! smile

   

Richard Olsson, Administrator
Posted: 16 June 2012 02:21 PM   Total Posts: 1192   [ # 1 ]

This sure does sound like a bug. Please file a bug report over at http://github.com/away3d/away3d-core-fp11/issues referencing this forum post and we’ll try to make sure it’s fixed ASAP.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X