thank you for your tipI know how its done. I already pointed out why i think you have your problem.
sorry I would help more, but i'm not keen on doing your work for you and i'm pretty busy with my own stuff.
...I like your accent by the way.
Here ya go! Hopefully it helps you out a bit.
Bending question response - YouTube
You could script what I did very easily.
Hey Rob,is there an option to make the < and > 40
something like ... distance value previous frame
// WORKING 50%
if (distanceDimensionShape3.distance == 40)
{
Centre_Sphere.translateY = 0;
}
else if (distanceDimensionShape3.distance > 40)
{
Centre_Sphere.translateY = Centre_Sphere.translateY - 1;
}
else if (distanceDimensionShape3.distance < 40)
{
Centre_Sphere.translateY = Centre_Sphere.translateY + 1;
}
Hi everyone. This was something leoie PMed me, and I thought it might help some other people as well.
Hey Rob,
Your expression has a problem with it, the same problem that I addressed in the first video. Your expression is incrementing Y based on it's last position, therefore whenever the distance is greater than 40, the sphere will continue downwards.
Eg.
Distance: 40, TranslateY = 0
Distance: 41, TranslateY = -1
Distance: 42, TranslateY = -2
Distance: 43, TranslateY = -3
That's no problem; however you run into a problem when it's descending.
Eg.
Distance: 43, TranslateY = -10
Distance: 42, TranslateY = -11
Distance: 41, TranslateY = -12
Distance: 40, TranslateY = 0
It's better to use a ratio, or equation, using the distance node, rather than incrementing relative to itself.
WARNING: MATH AHEAD!
Taking the definition of a line, the equation is y = m*x + b. Where m is the slope of the line, x is the position on the x axis, y is the position on the y axis, and b is a vertical-shift constant. We can therefore make it more-suited to your problem by making it translateY = slope*distance + vShift
To determine the factors, do the following:
Since you want the translateY to decrease by 1 every 1 increase in distance, m = -1.
Since you want translateY to be 0 at distance 40, b = 40.
Therefore you end up with y = -1 * x + 40; translateY = -1 * distance + 40.
Plugging in some example values, you get:
Distance: 30, TranslateY = 10
Distance: 39, TranslateY = 1
Distance: 40, TranslateY = 0
Distance: 41, TranslateY = -1
Distance: 50, TranslateY = -10
Here's what the resultant graph looks like:
Hopefully this makes sense.
Centre_Sphere.translateY = -1 * distanceDimensionShape3.distance + 40;
super....It's very simple to implement.
No if statements required.Code:Centre_Sphere.translateY = -1 * distanceDimensionShape3.distance + 40;
this is amazing.....It's very simple to implement. I was just showing how I derived that equation.
No if statements required. This would be very easy, faster, and better implemented using utility nodes.Code:Centre_Sphere.translateY = -1 * distanceDimensionShape3.distance + 40;
seems it is time to give up for now....It's very simple to implement. I was just showing how I derived that equation.
No if statements required. This would be very easy, faster, and better implemented using utility nodes.Code:Centre_Sphere.translateY = -1 * distanceDimensionShape3.distance + 40;
Ahh the story of my life. Many of the things you think will be simple, turn out to be much more difficult. This is why there are supervisors in the industry, to let the client know what is easy, and what is hard to do; and plan accordingly.
What you're dealing with here are constraints, expressions, utility nodes, animation, math, and history, all working together. Each time you add another entity, it makes it that much more complicated, and increases the probability that something will go wrong. This makes the interactions between each entity quite complicated, especially to a person that is new to the technical under-workings of Maya.
One potential reason why your objects would be going crazy would be through double-transformation. Say you have an expression evaluating on the translate X Y and Z of an object. Then you animated the translation of this object. You would then have two inputs going to the same value, which will cause problems.
What you're trying to accomplish is absolutely possible with Maya. I myself could do this for you, but it's my goal to help you learn how to do it yourself.