Notifications
Clear all
[Closed] Ray Direction
Sep 28, 2018 10:22 pm
I want to find the face intersected with the ray of positive X axis of an object, But the parameter “dir” of ClosestFace function doesn’t work as expected and near face at any direction will return.
delete objects
Obj = point wirecolor:yellow \
centermarker:off axistripod:on cross:off box:off constantscreensize:off drawontop:off
Target = box pos:[0,0,-10] height:50 width:200 length:20 wirecolor:blue
TheRay = MeshProjIntersect()
TheRay.setNode Target
TheRay.build()
TheRay.ClosestFace Obj.center dir:[1,0,0] doubleSided:true
HitPos = TheRay.getHitPos()
point pos:HitPos wirecolor:green \
centermarker:off axistripod:off cross:on box:off constantscreensize:off drawontop:off
Any idea?
1 Reply
Sep 28, 2018 10:22 pm
After the HitPos is found check if it is in positive X axis of the object.
if (HitPos * Target.transform).x > 0 then "posotive X" else "negative x"