ICustomBody::GetNormal returns Float4::null if..
.. no normal can be decided.
This commit is contained in:
parent
76c83add3d
commit
24418603ad
|
@ -124,10 +124,10 @@ Float4 & SimpleRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &targetMem
|
||||||
{
|
{
|
||||||
Float4 offset = worldPos - this->rigid.box.center;
|
Float4 offset = worldPos - this->rigid.box.center;
|
||||||
Float distance = offset.Dot( offset );
|
Float distance = offset.Dot( offset );
|
||||||
Float3 normal = Float3::standard_unit_z;
|
Float3 normal = Float3::null;
|
||||||
|
|
||||||
if( distance != 0.0f )
|
if( distance != 0.0f )
|
||||||
{
|
{ // sanity check
|
||||||
Ray ray( Float4::standard_unit_w, offset / (Float)::std::sqrt(distance) );
|
Ray ray( Float4::standard_unit_w, offset / (Float)::std::sqrt(distance) );
|
||||||
Float minDistance = numeric_limits<Float>::max();
|
Float minDistance = numeric_limits<Float>::max();
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@ Float4 & SimpleRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &targetMem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
targetMem.xyz = normal;
|
targetMem.xyz = normal;
|
||||||
|
targetMem.w = 0.0f;
|
||||||
return targetMem;
|
return targetMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ Float4 & SphericalRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &target
|
||||||
{ // sanity check
|
{ // sanity check
|
||||||
targetMem.Normalize();
|
targetMem.Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return targetMem;
|
return targetMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue