Hi, I’m trying to get the point on a certain model where I click with the cursor. I’ve managed to get it working, except when there’s another model in between.
I want the point in the model A, but there’s a model B in the way. The raycast should ignore B and keep going until it hits A.
I’m using the viewMask for that.
octree:RaycastSingle(cameraRay, RAY_TRIANGLE, M_INFINITY, DRAWABLE_GEOMETRY, 0x80000000)
Only A has a viewMask = 0x80000000. But still, it gets the point on B.
Am I doing something wrong? Should it work?
Alternatively, I could use the other RayQueryResult@ Raycast(…) and compare the node’s name to find the one I want. However I don’t know how to iterate on that array in lua, it says bad argument #1 to ‘ipairs’ (table expected, got userdata)