From c493b118fd989a976598bf3ead2ce2601a19f19e Mon Sep 17 00:00:00 2001 From: eduardodoria Date: Tue, 2 Jan 2024 11:56:17 -0300 Subject: [PATCH] Setting 2d body to be default dynamic --- engine/core/object/physics/Body2D.cpp | 4 ++-- engine/core/subsystem/PhysicsSystem.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/core/object/physics/Body2D.cpp b/engine/core/object/physics/Body2D.cpp index 60e3f4ce..c002c1f8 100644 --- a/engine/core/object/physics/Body2D.cpp +++ b/engine/core/object/physics/Body2D.cpp @@ -20,7 +20,7 @@ b2BodyType getBodyTypeToB2(BodyType type){ return b2_dynamicBody; } - return b2_staticBody; + return b2_dynamicBody; } BodyType getB2ToBodyType(b2BodyType type){ @@ -32,7 +32,7 @@ BodyType getB2ToBodyType(b2BodyType type){ return BodyType::DYNAMIC; } - return BodyType::STATIC; + return BodyType::DYNAMIC; } Vector2 getB2ToVector2(b2Vec2 vec2){ diff --git a/engine/core/subsystem/PhysicsSystem.cpp b/engine/core/subsystem/PhysicsSystem.cpp index ca0a5f42..ecc1c221 100644 --- a/engine/core/subsystem/PhysicsSystem.cpp +++ b/engine/core/subsystem/PhysicsSystem.cpp @@ -735,6 +735,7 @@ bool PhysicsSystem::loadBody2D(Entity entity){ bodyDef.userData.pointer = entity; body.body = world2D->CreateBody(&bodyDef); + body.body->SetType(b2_dynamicBody); body.newBody = true; return true;