Hello @chrislesage !
Just to follow up my suggestion, i’ve found a solution.
In mgear > core > vector.py, we can replace
def getPlaneNormal(v0, v1, v2):
vector0 = v1 - v0
vector1 = v2 - v0
vector0.normalize()
vector1.normalize()
normal = vector1 ^ vector0
normal.normalize()
return normal
by :
def getPlaneNormal(v0, v1, v2):
vector0 = v1 - v0
vector1 = v2 - v0
vector0.normalize()
vector1.normalize()
if vector0.isParallel(vector1):
normal = vector0 ^ datatypes.Vector(0, 0, -1)
else:
normal = vector1 ^ vector0
normal.normalize()
return normal
That way, if the two vectors (generated from the 3 positions) are parallel, we can determine arbitrary a normal vector so joints will be aligned, at least.
Note : up vector is based on world up vector here. If we want to improve the precision, we could add a parameter like fallback_vector that is given from the guide axis. With that, whatever the situation, joints will be aligned from the guide orientation only if they’re parallel, instead of being broken.
That might solve the problem, but the second part of the solution would need many refactor for a tiny problem. I guess the first part could at least reduce the impact of the bug.