ICustomBody::GetNormal returns Float4::null if..

.. no normal can be decided.
This commit is contained in:
Dander7BD 2013-12-19 11:21:14 +01:00
parent 76c83add3d
commit 24418603ad
2 changed files with 4 additions and 2 deletions

View File

@ -124,10 +124,10 @@ Float4 & SimpleRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &targetMem
{
Float4 offset = worldPos - this->rigid.box.center;
Float distance = offset.Dot( offset );
Float3 normal = Float3::standard_unit_z;
Float3 normal = Float3::null;
if( distance != 0.0f )
{
{ // sanity check
Ray ray( Float4::standard_unit_w, offset / (Float)::std::sqrt(distance) );
Float minDistance = numeric_limits<Float>::max();
@ -167,6 +167,7 @@ Float4 & SimpleRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &targetMem
}
}
targetMem.xyz = normal;
targetMem.w = 0.0f;
return targetMem;
}

View File

@ -130,6 +130,7 @@ Float4 & SphericalRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &target
{ // sanity check
targetMem.Normalize();
}
return targetMem;
}