SpiderPig Posted June 15, 2023 Share Posted June 15, 2023 I thought I'd better post this here as I think it's a bug. Though I'm not sure... I can't seem to get the mesh to collide with the falling cube - I think I got the collider in the right spot to catch the cube. #include "UltraEngine.h" #include "Components/Mover.hpp" 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 world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 1, -5); camera->SetDebugPhysicsMode(true); //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); bool flip = true; float extents = 3.0f; vector<Vec3> verts; if (flip == false) { verts.push_back(Vec3(-extents, 0.0f, -extents)); verts.push_back(Vec3(extents, 0.0f, -extents)); verts.push_back(Vec3(0.0f, 0.0f, extents)); } else { verts.push_back(Vec3(-extents, 0.0f, -extents)); verts.push_back(Vec3(0.0f, 0.0f, extents)); verts.push_back(Vec3(extents, 0.0f, -extents)); } auto c = CreateMeshCollider(); c->AddFace(verts); c->Finalize(); auto pivot = CreateModel(world);//Works // auto pivot = CreatePivot(world);//Dosn't Work pivot->SetCollider(c); pivot->SetCollisionType(COLLISION_SCENE); world->SetCollisionResponse(COLLISION_SCENE, COLLISION_PROP, COLLISION_COLLIDE); //Main loop vector<shared_ptr<Entity>> cubes; while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE) == true) { auto cube = CreateBox(world); cube->SetPosition(0.0f, 10.0f, 0.0f, true); cube->SetMass(1.0f); cube->SetCollisionType(COLLISION_PROP); cubes.push_back(cube); } world->Update(); world->Render(framebuffer); } return 0; } Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 9, 2023 Author Share Posted July 9, 2023 Hey @Josh, do you have time to take a look at this soon? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 9, 2023 Share Posted July 9, 2023 Did you try reversing the order of the vertices so the triangle will face in the opposite direction? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted July 9, 2023 Author Share Posted July 9, 2023 I think I did... but let me check again... Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 9, 2023 Author Share Posted July 9, 2023 Tried it and it made no difference. I'm pretty sure I've put the collider in the right spot... Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 9, 2023 Author Share Posted July 9, 2023 It was working until the new system you made with mesh colliders by using AddFace(). Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted July 16, 2023 Solution Share Posted July 16, 2023 This is fixed in today's update. CreateMeshCollider arguments have changed. You can either input a triangle or quad mesh, or a vector-of-vectors of Vec3s. The first is the simple usage, the second one handles faces with any number of edges, and different numbers of edges for each face. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
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.