PDA

View Full Version : keeping objects on a poly surface


bendingiscool
02-22-2009, 06:15 PM
Hey, Basically I'm looking for a way to have objects (polyCylinders in this case) move around but stay on a poly surface (polyPlane), I have expressions on the cylinders to make them randomly move.

Now one technique could possibly be to geometryConstrain the cylinders to the surface, however I have tested this technique and it doesn't give very accurate results.

Can anyone think of another way of going about this, I'm guessing something could be done by getting the normal data from all the faces of the poly surface but I'm not sure what my next step would be.

Many thanks, Chris

greatPumpkin
02-22-2009, 07:04 PM
use a closestPointOnMesh node. I'm not sure where in the UI you can create it, but you can create it in mel by running:

createNode closestPointOnMesh;

it has an input for position, and input mesh, and outputs a worldspace position. so you can use a locator to input the position, and the output will go to your cylinder.

bendingiscool
02-22-2009, 07:39 PM
Thanks for the idea, I am having trouble with the setup though, I can make the node fine and connect stuff up, however I'm unsure of the setup for the locator and cylinder, as in how/if they are connected in someway.

Thanks, Chris

EDIT: Nevermind I was just being a dumbass, been looking at a screen for far too long ;)

Cheers again

dr.rastaman
02-23-2009, 11:16 AM
You can create Hair follicles and use them as a parent for your object. I wrote a small script that creates follicles at selected vertices. You can download it here:
rCreateFollicle.mel (http://www.n8mensch.de/scripts/rCreateFollicle.mel)

Ooops, just saw that you want to animate your objects, thought you wanted them to stay in place... Then the closestPointOnMesh-thing is the better way. But anyways, you could animate the uv parameter to move the follicle around...

CGTalk Moderation
02-23-2009, 11:16 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.