Jump to content

CreateMeshCollider() with no arguments?


Go to solution Solved by Josh,

Recommended Posts

  • Solution
Posted

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.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

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.

Patches.png.8d9e56a5cfecf52f02a87b87b2c44912.png

Posted

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?

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

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.

Posted
for (auto i : polyindices)
{
	points.push_back(vertices[i])
}
AddFace(points);

 

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

You could also just call entity::BuildMeshCollider() or entity::BuildConvexHullCollider().

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

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.

×
×
  • Create New...