4
\$\begingroup\$

I'm using the PhysX 3.3 SDK in a application and mostly everything is working fine. However, I'm trying to develop a feature that would allow users to click on various actors in the scene and modify their properties.

My approach so far has been to use the PhysX raycast to query the scene and use RaycastHit to return a pointer to the actor. This works fine for rigid bodies, but for cloth actors, the hit is invariably null.

This suggests that PhysX can't raycast against cloth objects, but other than my tests, I haven't seen anything in the docs (or on the interwebs) that say this definitively.

Any thoughts?

\$\endgroup\$
2
\$\begingroup\$

As i cannot comment yet, as an answer:

Raycast against the bounding-box, not the actual cloth itself. This may not be perfect, but it's fast. The drawback would be the clicks slightly besides the cloth would be considered a hit. Which is most probably neglectable unless those clicks have critical consequences. (Think sniper-shots in a game.)

More complex and much slower could be to check the click against rendered buffer. Render each cloth as full white to a black background from the same perspective the clicking user sees it from and check if click position falls on white or black pixel. Wouldn't recommend that though.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.