STUFF LEARNED ABOUT OBJECT TRAVEL ACROSS SURFACE

Oh dear...
Sometimes trying to acomplish the most simple things leads to many discoveries about the tools that you use. I will most definitely have to catalogue this because I don't want to have to figure this out in the future....

Techniques to have multiple objects travel across a surface in random different directions while obeying surface normals and directions.

My first intuition was to run random instanced particles across a surface and somehow stick them to the surface. This can be done. Make a surface live, sketch particles on, throw down some gravity and get those particles moving...
*but what if you need to direct those particles and also have them 'stick on'? Gravity will tell them that if they hit an edge, to fall off the surface. Plus with fields, you can't direct particles as precise as a picky client wants them :)
So I figured, why not make the surface a goal? Great! So the particles move towards the vertices of the surface. As well, you can randomize those final goals with GoalU/V expressions.
*problem? Yes. If you have particles on a curved surface they will pick a goal but will not travel across it. It will pick the shortest line to that goal and intersect with your GEO. Of course...you haven't told your particles to obey a surface.
This is where ClosestPointOnSurface node comes in...what is this?
It's a node that isn't very documented or implemented (or user friendly for that matter) in Maya that allows an object to query where the closest point on a surface is at any moment and use it's info for whatever purposes one needs. So what you can do is have the instanced particles "ask" maya at every frame "where is that point on the surface I am travelling across - oh there it is, let my position stick to it".
*problem? Yes. This method doesn't tell the instances to rotate themselves based on the surface normals! So you have objects that flow across a surface with their back always facing straight up, even if on a hill.
Well, it seems that some people have gone as far as to use an aim contraint, with some intense expressions, tell the instances to aim their backs towards a normal that is tied to the aim constraint...but at this point I said "I'm an ANIMATOR not a Fu@ki# code alien" and gave up.

*Maya and objects travelling across a surface in random directions...obeying normals - NOT an easy task. This is obviously why there are expensive crowd simulation tools to do this.

TECHNIQUE

*Good old motion paths.

1. Create a nurbs surface with as many bumps or curves that you need.
2. Create your object that you want to animate.
3. Make your surface live.
4. Draw a curve anywhere on it. This curve becomes a curve on surface. Editable
and moveable across the surface.
5. Attach your object to the motion path using 'normal' as your world up type.

There it is. A completely animateable surface object towards any goal, following
normals, completely directable and editable.

Needs 1000's like an army? Just duplicate the curve and object with input
graph selected and randomize as you duplicate. The nice thing is that the curve on surface
follows the surface at all times.

TECHNIQUE #2

Normal and geometry constraints.

1. Create your object and your surface.
2. Group your object and goemetry and normal constraint the group to the surface
so that you can rotate your object on it's local Y axis as well.
3. Your rotation might be off but no problem. Rotate the child object or move it
to align to surface.
4. Move and animate your object across the surface!

* the only problem is that if your surface's normals are weird, your object's
rotation may be affected. Good for flat to moderately curvy surfaces.

Comments

Anonymous said…
O one solution to getting the particle instances to always face according to the surface normal they are goaled to is to 'Create goaWorldNormalOPP' (in the instancer node under Goal Weights and Object) - then, in the Rotation Options section, set 'AimDirection' to that (i.e. goalWorldNormalOPP). I imagine this should also work with the closestPointOnSurface approach you describe?
TheCrone said…
I tried for ages to play with the goalWorldNormalOPP and hook it in somehow. That attribute did not work for me at all.

Popular posts from this blog

Maya A/B transform match script