Jump to content

Collider Not Removed From Object


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

Not sure if this is a bug or not a good way to use the physics engine ;)

The box will still collide with the floor if you store it's collider elsewhere and set the boxes collider to nullptr.  Are colliders unique to the object they are applied too?

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto framebuffer = CreateFramebuffer(window);
    auto world = CreateWorld();
    world->SetGravity(0.0f, -2.0f, 0.0f);

    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetPosition(0, 0, -8);
    camera->SetDebugPhysicsMode(true);

    auto light = CreateDirectionalLight(world);
    light->SetRotation(35, 35, 0);

    auto box = CreateBox(world);
    box->SetMass(1.0f);
    box->SetColor(0, 1, 0);

    auto store = box->GetCollider();
    box->SetCollider(nullptr);//Will still collide...

    auto floor = CreateBox(world, 10, .1, 10);
    floor->SetPosition(0, -2, 0);

    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...