Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

hit tests

The hit test documentation seems a little ... terse. I'm trying to get a bit more information about the results, specifically I'd like to be able to find out what was hit. So far I've been able to get the position, rotation, and type of the hit test. The documentation says that there's an extent field, but this always returns nil (also, this part of the documentation seems identical with that of the anchors). Looking at the metatable for the result also doesn't shed any light.

So what information is contained within the hit test result?

Comments

  • Posts: 299

    Looking at the ___getters and ___setters tables, I see that there are fields: position, rotation, distance, and type. So distance is the one I didn't know about, but I don't know what distance it measures. Also, there doesn't seem to be anything that answers my question about figuring out what was hit.

  • Posts: 453

    @LoopSpace I dind't had time to take an in depth look at it yet, but from the AR example project I see this line: local results = scene.ar:hitTest(vec2(touch.x, touch.y), AR_EXISTING_PLANE_CLIPPED)

    As far as my understanding goes: it seems that you hit either nothing (if no plane was established yet) or the detected plane. So I think you always get a point at the end. This point represents the position at which the ray stopped (because of its intersection with the plane/object). Along with the world position of that ray you also get its local rotation vector and the distance from camera to the world position of that same ray.

  • Posts: 299

    @se24vad Right, but that still doesn't tell me which of the various detected planes was hit. It just feels that that would be useful information to have.

Sign In or Register to comment.