Jump to content

Capsule Collider goes through floor


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

Run this example and you will see that the capsule collider goes through the floor before it collides.  May need to enable wireframe after it collides to see that it's below the floor.

#include "Engine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Create a world
    auto world = CreateWorld();

    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetPosition(0, 2, -6);
    camera->SetDebugPhysicsMode(true);

    //Create light
    auto light = CreateDirectionalLight(world);
    light->SetRotation(35, 35, 0);
    light->SetColor(3);

    auto floor = CreateBox(world, 100.0f, 0.1f, 100.0f);

    auto box = CreateCylinder(world, 0.5f, 1.8f);
    box->SetMass(1.0f);
    box->SetPosition(0, 4, 0);
    box->SetCollider(CreateCapsuleCollider(0.5f, 1.8f));
    
    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...