Remove Box2D

This commit is contained in:
Isuru Samarathunga
2025-09-28 21:53:23 +05:30
parent 2bd9fb91fc
commit 3c5792e975
11 changed files with 3 additions and 482 deletions

View File

@ -2,8 +2,6 @@
#include <IAEngine/Input.hpp>
#include <IAEngine/Rendering/Camera.hpp>
#include <IAEngine/Components/PhysicsBody2D.hpp>
#include <IAEngine/Components/BoxCollider2D.hpp>
#include <IAEngine/Components/SpriteRenderer.hpp>
#include <IACore/File.hpp>
@ -13,7 +11,6 @@ namespace ia::iae::game
RefPtr<Scene> scene;
RefPtr<Node> g_player;
PhysicsBody2DComponent* g_playerPhysicsBody{};
VOID Game::Initialize()
{
@ -34,18 +31,6 @@ namespace ia::iae::game
});
t->BakeAnimations();
}
{
g_playerPhysicsBody = g_player->AddComponent<PhysicsBody2DComponent>();
g_playerPhysicsBody->IsDynamic() = true;
const auto collider = g_player->AddComponent<BoxCollider2DComponent>();
collider->Rect() = {
0,
0,
g_player->DrawnSize().x,
g_player->DrawnSize().y,
};
collider->IsDebugDrawEnabled() = true;
}
g_player->Tags() = NODE_TAG_PLAYER;
g_player->SetLocalPosition({200, 200});
@ -63,16 +48,7 @@ namespace ia::iae::game
});
t->BakeAnimations();
}
{
obstacle->AddComponent<PhysicsBody2DComponent>();
const auto collider = obstacle->AddComponent<BoxCollider2DComponent>();
collider->Rect() = {
0, 0,
obstacle->DrawnSize().x,
obstacle->DrawnSize().y
};
collider->IsDebugDrawEnabled() = true;
}
obstacle->Tags() = NODE_TAG_GROUND;
obstacle->SetLocalSortIndex(20);
obstacle->SetLocalPosition({200, 400});
@ -89,8 +65,5 @@ namespace ia::iae::game
VOID Game::Update()
{
if(Input::WasKeyPressed(Input::KEY_SPACE))
g_playerPhysicsBody->Jump(200.0f);
g_playerPhysicsBody->SetVelocityX(Input::GetDirectionalInput().x * 100.0f);
}
}