diff --git a/Code/GamePhysics/Implementation/SimpleRigidBody.cpp b/Code/GamePhysics/Implementation/SimpleRigidBody.cpp index dff17bac..70636708 100644 --- a/Code/GamePhysics/Implementation/SimpleRigidBody.cpp +++ b/Code/GamePhysics/Implementation/SimpleRigidBody.cpp @@ -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::max(); @@ -167,6 +167,7 @@ Float4 & SimpleRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &targetMem } } targetMem.xyz = normal; + targetMem.w = 0.0f; return targetMem; } diff --git a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp index 13a46145..e31fd0df 100644 --- a/Code/GamePhysics/Implementation/SphericalRigidBody.cpp +++ b/Code/GamePhysics/Implementation/SphericalRigidBody.cpp @@ -130,6 +130,7 @@ Float4 & SphericalRigidBody::GetNormalAt( const Float4 &worldPos, Float4 &target { // sanity check targetMem.Normalize(); } + return targetMem; }