Billy_The_Kid

is their a way to create locators on a mesh surface that will update their position on the colliding objects surface... essentially like a projected rivet? Can do a work around right now with projecting geo onto the surface then creating rivets and locators to the vertices

Reply 0 0
noizfactory
How about you instance locators at the ray projected vertex positions instead of first creating them? You can then bake them after your final position is evaluated using soup's uninstancer.
Reply 0 0
Billy_The_Kid
I need it to be live instead of baked
Reply 0 0
noizfactory
I just thought of another way to do this without using instancing. You can pipe the rayProject.outGeometry to point.inGeometry and in the point node's position expression use this:

 

string $loc_name = "loc_" + $ID;;

if(`objExists $loc_name` < 1)

{

createNode -n $loc_name "locator";

}

 

// POINT POSITION

$X=$TX;

$Y=$TY;

$Z=$TZ;

 

string $loc_t[] = `listRelatives -p $loc_name`;

xform -t $X $Y $Z $loc_t[0];

 


This creates a locator at every point position if it doesn't exist already and then transforms it to the point position. It updates with the scene as well (just remember to connect outGeometry from point node to a displayComponents node to force an evaluation). I've attached a scene with both approaches.

 

Reply 0 0
noizfactory
Billy_The_Kid wrote:
I need it to be live instead of baked
Yeah, figured as much. Check the post above.
Reply 0 0
Billy_The_Kid

could'nt open the scene but did what u said using the point node. Words a treat thanks :)

Reply 0 0
noizfactory
Glad it works for you. It's a Maya 2013.5 scene so you'll probably need to edit the ASCII file.
Reply 0 0
Billy_The_Kid
So if I wanted to convert animated locator positions into a world mesh so that I could plug that into the inGeometry of the rayProject node how would I do that?
Thanks again for your help on this
Reply 0 0
noizfactory
I don't think you can directly plug the locator transforms into a mesh. What you can do is use the transformsToArray node and get the position array of the locators and then connect the outPositionPP to a pointCloudToCurve node. You can connect this to a curveShape.create and project this using the rayProject.
What I don't understand though is that since your locator positions are derived from a projected mesh in the first place, why can't you use that directly? Seems like a roundabout way of doing this. What exactly are you trying to do here?
Reply 0 0
Billy_The_Kid
Because the object needed to be projected is currently being created with another script using matchmoved locators. Created procedurally would be better. And on that note, I've done what u said using the transformToArray, and that worked... Problem I'm having is if I want to add a locator into the transformToArray node, it doesn't update down stream to the projected locators. I get an error saying object not found. Guess the position script in the point node would have to be different. Aka keeping track of locator names already in scene
Reply 0 0
noizfactory
Yeah the current expression in the point node tracks it based on the locator name which itself is based on the point id. It's a very hacky method and for your scene may not work. Is the new locator that you're adding not related to any vertex position?
I think this would be much easier to do with a pyExpression node as was suggested in your other thread.
Reply 0 0
Billy_The_Kid
no it isn't just locators parented to a camera
Reply 0 0
pshipkov
The nature of the dag makes it hard to proceduralize creation deletion of nodes. You can do scriptjobs and callbacks to handle that part. Or comprehensive system like mograph has to be put in place. That's hard because there is no safety nets in the api for proceduraly handling dag objects. It makes it very easy to break everything.
Reply 0 0
MCGrund
Hey noizefactory, just out of curiosity how would I connect the curve node into the RayProject? I couldn't really get that to work.
Reply 0 0
MrFurious
i've done something very similar.  take those locators and create a piece of bs go that matches a vert per locator (you need at least 3 locators, that you cluster each vert and parent constrain to the match move locator) to create a flat mesh were the locators are.

then ray project that mesh on to your target mesh and simply rivet locators to each vert on the new ray projected mesh.  be sure to use the cameras transform location for the origin of the ray project.

bake out to world space when ready.

i'll see if i can dig up some of my scripts for that.
Reply 0 0
Reply