Closed a908778387 closed 5 years ago
This sounds like an issue with collision shape interpolation.
I've not used the triangle API for a use case like this before, so it is just a guess.
Are you using setTriangles(Range<const physx::PxVec3> triangles, uint32_t first, uint32_t last)
or setTriangles(Range<const physx::PxVec3> startTriangles, Range<const physx::PxVec3> targetTriangles, uint32_t first)
?
You probably want to use the latter one to control the interpolation, using the first one makes it really complicated to get the triangles to match up with the previous frame.
I did use the previous API. Every frame I use a std::vector
I did use the previous API. Every frame I use a std::vector triArray to collect collisions, so the vector's length and value inside may be quite different between frames sometimes. And then I use cloth->setTriangles({&triArray.data(), &triArray.data()+triArray.size()}, 0, cloth->getNumTriangles()). If it's an interpolation issue, any idea to git rid of this? Many many thanks.
Oh, I think I get the key point from your advice. Still two question, first one is for confirmation.
If I use this API, I should consider the interpolation maters. The previous one setTriangles(Range<const physx::PxVec3> triangles, uint32_t first, uint32_t last)
is really complicated to control the collision if the cloth collision with the dynamic number of triangles. In my case, it's better to use the latter one, and I should manage the startTriangles and targetTriangles myself ?
And another problem is if I want to do the same thing to the PhysX Sphere Shape. but only void setSpheres(Range<const physx::PxVec4> spheres, uint32_t first, uint32_t last)
I can found, any advice to make it work?
Many thanks !!
In my case, it's better to use the latter one, and I should manage the startTriangles and targetTriangles myself ?
Yes that is probably the simplest way.
As for the setSpheres
api, we didn't add the new style here yet unfortunately.
In this case you need to keep track of the spheres in the buffer yourself, or add the new API yourself.
You can remove spheres by using an empty range for the first argument, and insert spheres by setting the first and last index to the same value.
If I ever get back to this I'll add the new style api for the spheres as well, but I can't give any time estimates right now.
Thank you very much!
I added new setSpheres and setPlanes apis. I hope it will be useful for you.
It will be very useful, thank you!
Hi, It's me again ~_~ I'm trying to make cloth can collide with the scene object. And I make it work with PhysX. I wrap the cloth's bounding box as a PxBoxGeometry. And then use the box to collect all triangles nearby, store it into std::vector TriangleList, and use the setTriangles to make collision detection work.
And now I found a strange phenomenon, I have two box model each one can work well with the cloth, but if I put them both, the cloth will disappear. I check my code over and over but found nothing wrong. Do I have any misunderstanding about him? NvCloth's API?
Many many thanks.