0

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.

Lala_Ghost
  • 211
  • 1
  • 12
  • 1
    why not using a rivet (in muscle menu, you can find a maya native one) or pointOnPoly Constraint or even a follicle ? – DrWeeny Oct 15 '19 at 18:58
  • You can use Muscle's surface attach like DrWeeny suggested. And instead of deleting it at every iteration just change the edge indexes then delete it once your loop is done. @DrWeeny Thanks for mentioning this, I usually only used follicles, but the surface attach feels a lot easier to use and isn't so bloated. Do you have any idea if it performs faster and works ok with parallel evaluation? – Green Cell Oct 16 '19 at 02:51
  • The surface attach is really sensitive to pivot and really lightweight, i didnt benchmark since parallel evaluation feature. – DrWeeny Oct 16 '19 at 03:03
  • That works okay, but not perfect. I don't like that I have to load a plugin for that and I have to select the face the tube is touching and I don't know how to But if I cannot get around using MayaMsucle I can live with loading a plugin So how do I get the face the tube is touching? – Lala_Ghost Oct 16 '19 at 12:47
  • Did some benchmarks and found out that Muscle's surface attach is about 2 times slower than follicles. I wouldn't use them! – Green Cell Oct 18 '19 at 06:18
  • Neither follicle nor surfaceAttach works as thought follicle is UV based, I cannot guarantee that UVs are good – Lala_Ghost Oct 18 '19 at 10:29

1 Answers1

1

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

Lala_Ghost
  • 211
  • 1
  • 12