|
|
The Claw (Expressions) Added on: Sat Jul 01 2000 |
Page: 1 2 3 4 |
It is time to write the expression.
There are three sections to the opening and closing of the claw. One is high up when the
claw is always closed. The second is when it is approaching the ball which is when it will open up. And the third is when it is closing again. (I didn't worry about what happens when I goes down past the ball. Just don't make the claw go down to far in an animation.)
Here is the three sections in equation form:
(X - Y) = Delta of X and Y <- Brief Math Catch-up...This is just the distance between the two objects
ConPos.z - BallPos.z > 21 (When the claw is always closed)
ConPos.z - BallPos.z > 14 & ConPos.z-BallPos.z<21 (When the claw will open)
ConPos.z - BallPos.z > 7 & ConPos.z-BallPos.z<14 (When the claw will close again)
(The .z denotes the z-axis) Here it is in English
When the Claw is 21 units away or more it is closed.
From 21 units away to 14 units away the claw will open.
From 14 units away to 7 units away the claw will close.
Now for the angles at >21 the angle will aways be 0 degrees
from 21 to 14 the angle will be changing from 0 to -35 degrees
from 14 to 7 the angle will be changing from -35 back to 0 degrees
Since we just can't type in "open claw in a smooth linear fashion" we have to write an
equation for that too (Hmmmm Fun). There is a variety of ways to do this. I did it based on the distance between the two objects.
Ok when the claw is at 21 units away I want it to be at 0 degrees (closed) and when
it is at 14 units I want it to be at -35 degrees (open). So what value would be proportional that would make 0 to 7 be 0 to 35. (Answer is 5) so lets look at the sections again with the claws opening/closing included.
"ConPos.z - BallPos.z > 21" (nothing amazing about this)
"ConPos.z - BallPos.z > 14 & ConPos.z - BallPos.z < 21 , (ConPos.z-BallPos.z-21)*5" (uh-oh this is a little complicated) Lets break it down...the first part is defining the second section (the & is the syntax for "and") and the second part is the conversion from 0 - 7 to 0 - -35. (ConPos.z - BallPos.z) = the distance inbetween, now you need to subtract 21 because that is the distance from the Shaft to the Ball.
For example: the shaft is 48in up and the ball is 27in up at the start of the "opening section". Now without the "-21" the equation would be "(48-27) * 5= 105 degrees". And you wanted 35 degrees.
With the "-21" it will give you 0. Using the same example, at the end of the "opening section" the equation will be "(41-27) *5 = 70". And again with the "-21" it will be -35 degrees, which is what we want.
"ConPos.z-BallPos.z >7 & ConPos.z-BallPos.z<14 ,(7-(ConPos.z-BallPos.z)*5 This is the same exact thing as the 2nd example but instead of "...-21" it is "7-...." for the same reasons. Work it out. =)
|
|
|
|