small bug fix on RayDebugObject

cloud9

01-05-2008 11:04:21

Hi.

I found using a ray with infinite length will do bad things in DebugLines::draw(). So I made RayDebugObject constructor and setDefinition look like this.


//------------------------------------------------------------------------------------------------
RayDebugObject::RayDebugObject(const Ogre::Vector3& start,
const Ogre::Vector3& direction,
const Ogre::Real length):
DebugObject()
{

Ogre::Vector3 end;

if(length == Ogre::Math::POS_INFINITY)
{
end = (start + (direction.normalisedCopy() * 100000.0));
}
else
{
end = (start + (direction.normalisedCopy() * length));
}

addLine(start, end);

draw();
}
//------------------------------------------------------------------------------------------------
void RayDebugObject::setDefinition(const Ogre::Vector3& start,
const Ogre::Vector3& direction,
const Ogre::Real length)
{
clear();

Ogre::Vector3 end;

if(length == Ogre::Math::POS_INFINITY)
{
end = (start + (direction.normalisedCopy() * 100000.0));
}
else
{
end = (start + (direction.normalisedCopy() * length));
}

addLine(start, end);

draw();
}

tuan kuranes

01-05-2008 16:27:11

Thanks!

Applied on SVN.