talk.bindpose.com has been shut down on the 6th of March 2021. You can read a bit more about it here.

You are currently reading an archived copy of the latest content, with all the usernames deleted.

Projecting nurbs curve cv to a polygon mesh using python api

by user9 posted 13-11-2017 | 3 comments

Is there a quick way to do that? I know maya has that feature, but I attempt to prevent maya creates history nodes. Even though I can delete it at the end.

Thanks

 

by user3 posted 13-11-2017

Depending on how exactly you want the projection to work, I think you have to options.

  • The simpler one is to just get the closest point on the mesh using getClosestPoint

  • If you want an actual projection along a vector you can use something like the closestIntersection function. The way it would work is starting from your CV position you cast a ray in the specified direction and you get the first intersection with the mesh along this ray.

Hope that helps!

 

by user9 posted 13-11-2017

thanks.

one more question, can I use active camera's attributes to yield the ray?

It would be a clever solution to my problem.

 

by user3 posted 13-11-2017

I suppose so. Not sure what the best way of getting the current active camera in your situation would be, but if you know the camera you can get it's forward vector (negative Z in Maya) and use that as the ray direction. You can get it from the camera's world matrix, where the third row of the matrix - elements [2][0], [2][1], [2][3] - are the Z axis and you just need to negate it.

Alternatively, you can get a projecting outwards vector that starts at the camera and goes through your CV by doing

directionVec = cvPos - cameraPos