Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document BulletClosestHitResult #154

Open
Germanunkol opened this issue Feb 4, 2025 · 1 comment
Open

Document BulletClosestHitResult #154

Germanunkol opened this issue Feb 4, 2025 · 1 comment

Comments

@Germanunkol
Copy link

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?
@ArsThaumaturgis
Copy link

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...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants