Increased the buffer and fixed the buffer calculation when moving backwards into objects

This commit is contained in:
Robert Osfield 2008-07-11 17:07:05 +00:00
parent 61a81d8e06
commit 45b2fb8db7

View File

@ -47,7 +47,7 @@ DriveManipulator::DriveManipulator()
_modelScale = 1.0;
_velocity = 0.0;
_height = getHeightOfDriver();
_buffer = _height*1.3;
_buffer = _height*2.5;
_pitch = 0.0;
//_speedMode = USE_MOUSE_Y_FOR_SPEED;
_speedMode = USE_MOUSE_BUTTONS_FOR_SPEED;
@ -75,7 +75,7 @@ void DriveManipulator::setNode(osg::Node* node)
//_buffer = sqrtf(_modelScale)*0.05;
_height = getHeightOfDriver();
_buffer = _height*1.3;
_buffer = _height*2.5;
}
if (getAutoComputeHomePosition()) computeHomePosition();
}
@ -542,8 +542,16 @@ bool DriveManipulator::calcMovement()
// check to see if any obstruction in front.
osg::Vec3d ip, np;
if (intersect(_eye,_eye+lv*(signedBuffer+distanceToMove), ip, np))
{
if (distanceToMove>=0.0)
{
distanceToMove = (ip-_eye).length()-_buffer;
}
else
{
distanceToMove = _buffer-(ip-_eye).length();
}
_velocity = 0.0;
}