SpiderPig Posted June 13, 2023 Share Posted June 13, 2023 Does CreateMeshCollider() not need a mesh as an argument any more? I may have missed something in one of the blogs... Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted June 13, 2023 Solution Share Posted June 13, 2023 Oh yeah, I changed the way this works. After creating the collider, call Collider::AddFace for each polygon / face. When you are done adding faces, call Collider::Finalize(). This gives you control over the exact number of vertices per face, and the finalize method also exposes the Newton optimize feature, which will attempt to merge adjacent coplanar faces. 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...
SpiderPig Posted June 13, 2023 Author Share Posted June 13, 2023 Ah awesome! I had a little freak-out when it didn't compile, but that way sounds much better, thanks. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 14, 2023 Author Share Posted June 14, 2023 Can AddFace() only take 3 vertices in the array? Quote Link to comment Share on other sites More sharing options...
Josh Posted June 14, 2023 Share Posted June 14, 2023 No, it accepts any number of vertices more than two. 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...
SpiderPig Posted June 14, 2023 Author Share Posted June 14, 2023 So I should take care to add them in a certain order? Like a triangle_strip in GLSL, otherwise I might get overlapping faces...? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 14, 2023 Author Share Posted June 14, 2023 I think the answer is yes... would it be practical to add the ability to set the indices? Just that going through this and adding vertices in order is going to be a headache to figure out. Quote Link to comment Share on other sites More sharing options...
Josh Posted June 14, 2023 Share Posted June 14, 2023 They are added in the order you specify, and form a concave polygon. Typically this is just used for quads or maybe brush faces. What are you trying to do? 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 June 14, 2023 Author Share Posted June 14, 2023 It needs refining, but currently I create a collider per voxel. This can be up to 5 or so triangles in total per collider. It worked the old way because I was able to set the indices as well. Quote Link to comment Share on other sites More sharing options...
Josh Posted June 14, 2023 Share Posted June 14, 2023 for (auto i : polyindices) { points.push_back(vertices[i]) } AddFace(points); 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...
Josh Posted June 14, 2023 Share Posted June 14, 2023 You could also just call entity::BuildMeshCollider() or entity::BuildConvexHullCollider(). 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...
SpiderPig Posted June 14, 2023 Author Share Posted June 14, 2023 Thanks, I'll see what I can do. Quote 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.