Fixed rigidbody serialisation

This commit is contained in:
Diren D Bharwani 2023-02-02 19:23:42 +08:00
parent 6a57be2e60
commit 71f4cdd29e
6 changed files with 21 additions and 23 deletions

View File

@ -1,4 +1,4 @@
Start Maximized: true
Working Scene ID: 97402985
Working Scene ID: 84373000
Window Size: {x: 1920, y: 1013}
Style: 0

View File

@ -1,4 +1,4 @@
- EID: 65536
- EID: 0
Name: Default
IsActive: true
NumberOfChildren: 0
@ -12,9 +12,9 @@
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: false
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Sleeping Enabled: false
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false

View File

@ -1,3 +1,3 @@
Name: x
ID: 91446183
ID: 84373000
Type: 5

View File

@ -216,7 +216,6 @@ namespace SHADE
{
.entityID = rigidBody->GetEID()
, .bodyType = rigidBody->type
, .flags = rigidBody->flags
, .interpolate = rigidBody->interpolate
, .drag = rigidBody->drag
, .angularDrag = rigidBody->angularDrag
@ -309,14 +308,14 @@ namespace SHADE
// Re-set properties
rigidBodyComponent->SetGravityEnabled (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::GRAVITY));
rigidBodyComponent->SetIsAllowedToSleep (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::SLEEPING));
rigidBodyComponent->SetFreezePositionX (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::LINEAR_X));
rigidBodyComponent->SetFreezePositionY (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::LINEAR_Y));
rigidBodyComponent->SetFreezePositionZ (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::LINEAR_Z));
rigidBodyComponent->SetFreezeRotationX (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::ANGULAR_X));
rigidBodyComponent->SetFreezeRotationY (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::ANGULAR_Y));
rigidBodyComponent->SetFreezeRotationZ (DEF.flags & SHUtilities::ConvertEnum(SHRigidBodyComponent::Flags::ANGULAR_Z));
rigidBodyComponent->SetGravityEnabled (rigidBodyComponent->IsGravityEnabled());
rigidBodyComponent->SetIsAllowedToSleep (rigidBodyComponent->IsAllowedToSleep());
rigidBodyComponent->SetFreezePositionX (rigidBodyComponent->GetFreezePositionX());
rigidBodyComponent->SetFreezePositionY (rigidBodyComponent->GetFreezePositionY());
rigidBodyComponent->SetFreezePositionZ (rigidBodyComponent->GetFreezePositionZ());
rigidBodyComponent->SetFreezeRotationX (rigidBodyComponent->GetFreezeRotationX());
rigidBodyComponent->SetFreezeRotationY (rigidBodyComponent->GetFreezeRotationY());
rigidBodyComponent->SetFreezeRotationZ (rigidBodyComponent->GetFreezeRotationZ());
rigidBodyComponent->SetInterpolate (DEF.interpolate);
rigidBodyComponent->SetDrag (DEF.drag);

View File

@ -47,7 +47,6 @@ namespace SHADE
{
EntityID entityID = MAX_EID;
SHRigidBodyComponent::Type bodyType = SHRigidBodyComponent::Type::STATIC;
uint8_t flags = 0; // aZ aY aX lZ lY lX sleepEnabled gravity
bool interpolate = true;
float drag = 0.0f;
float angularDrag = 0.0f;

View File

@ -152,14 +152,14 @@ namespace SHADE
enum class Flags : uint8_t
{
GRAVITY = 0x0
, SLEEPING = 0x1
, LINEAR_X = 0x2
, LINEAR_Y = 0x4
, LINEAR_Z = 0x8
, ANGULAR_X = 0x10
, ANGULAR_Y = 0x20
, ANGULAR_Z = 0x30
GRAVITY = 0x1
, SLEEPING = 0x2
, LINEAR_X = 0x4
, LINEAR_Y = 0x8
, LINEAR_Z = 0x10
, ANGULAR_X = 0x20
, ANGULAR_Y = 0x30
, ANGULAR_Z = 0x40
};
/*---------------------------------------------------------------------------------*/