Collision 1/2
This commit is contained in:
@ -23,6 +23,8 @@
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
Vector<PhysicsComponent *> g_physicsComponents;
|
||||
|
||||
VOID Physics::Initialize()
|
||||
{
|
||||
}
|
||||
@ -34,4 +36,27 @@ namespace ia::iae
|
||||
VOID Physics::Update()
|
||||
{
|
||||
}
|
||||
|
||||
Handle Physics::RegisterComponent(IN PhysicsComponent *component)
|
||||
{
|
||||
g_physicsComponents.pushBack(component);
|
||||
return g_physicsComponents.size() - 1;
|
||||
}
|
||||
|
||||
BOOL Physics::CanMove(IN Handle handle, IN CONST PhysicsComponent::Collider &collider, IN glm::vec2 movement)
|
||||
{
|
||||
const auto comp = g_physicsComponents[handle];
|
||||
const auto middle = comp->GetNode()->GetPosition() + movement + collider.Position + collider.Size / 2.0f;
|
||||
for (const auto &t : g_physicsComponents)
|
||||
{
|
||||
if (t == comp)
|
||||
continue;
|
||||
for(const auto& tc: t->Colliders())
|
||||
{
|
||||
const auto tMiddle = t->GetNode()->GetPosition() + tc.Position + tc.Size / 2.0f;
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace ia::iae
|
||||
Reference in New Issue
Block a user