Fixed bug with non-dynamic masses being overriden

This commit is contained in:
Diren D Bharwani 2022-12-21 19:04:10 +08:00
parent d109d06764
commit 92ed8a29ff
3 changed files with 3 additions and 2 deletions

View File

@ -72,7 +72,7 @@
RigidBody Component: RigidBody Component:
Type: Static Type: Static
Auto Mass: false Auto Mass: false
Mass: 1 Mass: .inf
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: false Use Gravity: false

View File

@ -319,6 +319,7 @@ namespace SHADE
{ {
if (bodyType != Type::DYNAMIC) if (bodyType != Type::DYNAMIC)
{ {
invMass = 0.0f;
SHLOG_WARNING("Cannot set mass of a non-Dynamic Body {}", entityID) SHLOG_WARNING("Cannot set mass of a non-Dynamic Body {}", entityID)
return; return;
} }

View File

@ -20,7 +20,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
SHRigidBodyComponent::SHRigidBodyComponent() noexcept SHRigidBodyComponent::SHRigidBodyComponent() noexcept
: type { Type::STATIC } : type { Type::DYNAMIC }
, interpolate { true } , interpolate { true }
, rigidBody { nullptr } , rigidBody { nullptr }
{} {}