View Full Version : Negative distance?

11-29-2012, 02:46 PM

I'm looking for a way to do a node setup. I want to create an effector for a morph map using nodes. The basic idea is this:

While the null is far away the morph = 0, as the null approaches and passes any spot on the mesh the morph value becomes 100 and stays at 100 as the object continues to travel past

Make sense? Right now I have the effector set up that increases the morph as the object approaches, but as the object passes and continues past, the morph decreases back to zero.

It seems that I would need something like positive distance and negative distance, but I'm not sure how to manage that with nodes.

Any advice would be MUCHO appreciated.



11-29-2012, 03:08 PM
Distance can't be negative, sqrt is never returning negative values.

Why are complicating your life? Make envelope and problem solved.

But if you want to learn direction you can use Dot product between incoming vector and some constant. It'll be negative then turn to positive (or reverse, depending on const vector).

11-29-2012, 03:24 PM
If you don't mind a flat X, Y, or Z line, you can 'Show Output' on the gradient keys and plug the item info into the key positions with one of the branches going through a math node to control the distance between the keys.

It'd be nice (and there may be a way) if you could add a bit of logic to say "if a value reaches a set level, then hold that level".

11-30-2012, 02:52 AM
A bit of the right ordering in your nodes, and you can effectively take each polys position (spot position) and "re-ground" that as 0, with positive pace vals off in the nulls original direction, and negative ones to its other side... then take the nulls position as relative to each spot. Using a clamp node, you can then lock behaviour at pos=0 and lower values.

11-30-2012, 01:31 PM
Thanks for the input guys. Ironically I got around this by using a different approach and used some knowledge I gained from the Rebel Hill node tuts to dial it in. I ended up using texture maps to drive the morph. Works great!