Skip to content
Discussion options

You must be logged in to vote

rayMeshIntersect always returns at most one intersection. closestIntersect=False does not return more of them: it lets the search stop at the first intersection it finds, which may not be the closest one. That is faster when you only need to know whether the ray hits the mesh at all.

To get every intersection, use rayMeshIntersectAll. It calls your function once for each intersection. Return True to keep searching, or False to stop:

import meshlib.mrmeshpy as mm

mesh = mm.makeSphere(mm.SphereParams())  # unit sphere at the origin
ray = mm.Line3f(mm.Vector3f(-5, 0.1, 0.2), mm.Vector3f(1, 0, 0))

hits = []
def onHit(res):
    hits.append((res.distanceAlongLine, res.proj.face.get(), res.proj.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ManuGraiph
Comment options

Answer selected by ManuGraiph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants