Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to perform ray casting on a mesh using libgdx.

I found this code sample and it misses some explanations. What do these vectors stand for? What is globalIntersection and localIntersection?

share|improve this question

closed as off topic by Laurent Couvidou, Jari Komppa, Byte56, Trevor Powell, Josh Petrie Dec 7 '12 at 16:42

Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

1 Answer 1

  • globalIntersection is the nearest intersection to the origin of the ray.
  • localIntersection is the intersection of a mesh with the ray.

The simplified algorithm is:

iterating on the meshes:
    find the intersection of current mesh with ray (localIntersection)
    if intersection is near that globalIntersection:
        update globalIntersection with localIntersection
share|improve this answer
add comment

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