panda3d-docs
panda3d-docs copied to clipboard
Document BulletClosestHitResult
I've frequently stumbled across the BulletClosestHitResult page and it was usually not able to answer my questions.
It'd be great if it could get some attention!
Here are a few questions I have when reading the page:
- What are from_pos and to_pos, how are they different?
- Is hit_fraction the relative distance along the ray?
- What does shape_part index into?
- What is hit_normal, and why does it always face towards the origin of a ray?
- What exactly does triangle_index index into, and is it always guaranteed to be set? Or only if the TO object was a BulletTriangleMesh?
Thoughts on two of those points:
What are from_pos and to_pos, how are they different?
I would guess that these are the points the define the line-segment used to perform the test: "from_pos" being the starting point, and "to_pos" being the ending point. (Especially as their nomenclature matches that of the relevant parameters to the "rayTestClosest" method.)
It would be easy enough to test this: perform a closest-hit test, and see whether the data in these two variables matches the data used to perform the test.
What is hit_normal, and why does it always face towards the origin of a ray?
This should be simply the surface-normal of the object that was hit by the ray--that is, a vector pointing "away" from the surface of the object that was hit.
And since the ray can presumably only hit surfaces that face it, this normal will generally point more-or-less towards the origin of the ray.
Or are you saying that you're seeing these normals always point exactly towards the origin of the ray, regardless of the angle of the surface that the ray hits...?