Reputation: 211
In Maya: I have a tube whose pivot is on a plane that is rotated but the pivot does not lie on a vertex. I want to rotate the tube around its pivot so it is perfectly aligned with the normal vector of the face nearest to the pivot of the tube.
I tried to do get the normal of the face with a closestPointOnMesh(you can find it under Constrain > Closest Point), but I could not get it to work. I would like to not use normalConstraint and deleting it afterwards because they are quite slow and I plan to do it on a lot complex objects.
Upvotes: 0
Views: 337
Reputation: 211
I am now working with a normalConstraint but before deleting it I disconnect the $constraintName.$target + 'W0' and $constraintName + '.target[0].targetWeight'
and the $targetShape + '.worldMesh[0]' and $constraintName + '.target[0].targetGeometry'
(these connections are default connections a normalConstraint creates)
by disconnecting the attributes before deleting the constraint I cut the deleting time almost by half! Don't know why!
Maya API NormalConstraint: https://help.autodesk.com/cloudhelp/2019/ENU/Maya-Tech-Docs/CommandsPython/normalConstraint.html
Upvotes: 1