I have written a volumetric raycast class that uses a cylinder shape to perform contact tests with collision objects.
This is working fine for me except for the following two things:
1. The collision normal for each point I get is often unusable because world::contactTest generates a normals spanning outwards from the testing cylinder instead of outward from the colliding object ( and most of my objects are scaled triangular meshes )
2. Using world::contactTest is understandably expensive and has a significant toll on performance.
I use this test for two things in my application.
1. The first is for interaction tests originating from touch devices, which don't have the pixel perfect precision a mouse pointer has.
It seemed to me that mapping touches to volumetric raycasting of cylinders or cones was a sensible approach.
2. The second use is much more specific to my simulation, but it regards simulating tangling strings under tension.
I test string/object collisions using this method.
Here are my initial takes on these two issues:
The way I've imagined solving the accuracy of the collision normal is by replacing the cast cylinder/cone with custom shape and create a new collision algorithm which handles the collision and calculates the normals as needed.
Regarding performance issues, I'm absolutely in the dark as to a way of lightening the performance hit.
Drilling down in my profiler call tree, the bulk performance hit happens here:
Code: Select all
btGjkPairDetector::getClosestPointsNonVirtual(btDiscreteCollisionDetectorInterface::ClosestPointInput const&, btDiscreteCollisionDetectorInterface::Result&, btIDebugDraw*)
I would love to hear your insight on ways of making this an accurate and/or fast test or perhaps better ways of solving this problem.