[Closed] modifyer-value controled by y-rotation
hi
I’m trying to controle a bend modifyer by the y-rotation of the objects parent(or its own pivot)
It is a tree on a plane, and the plane is rotating on its y axis. the idea is that the faster the plane rotates, the more the tree gets bended. but it should never bend more than 90°.
so there are several problemes in this.
how do i check for rotation value per time?
and how do i get a non linear bending strength. I mean, it should never bend more than 90°, but it also should not get suddenly 90°
…I think more of never reach this 90°, but the nearer it gets to them, the slowlier it bends more.
I think of a hyperbola curve. But I have no idea how to do this
I never tought that i would ever use mathematic, when i was in school…
hope somebody can help
one approach could be this one:
you have a plane that rotates and a something that bends
in the angle track of the bend modifier of the bending object create a float_script.
create two variables turner and turner_future
assign both to the rotating rotation track of the turntable object.
offset the turner_future variable to the futer using the tickoffset parameter.
now you measure the rotation of the turntable object every frame and somewhere in the future.
timediff = turner_future – turner
the difference between both values tells you how fast the object is turning.
to get a linear interpolation between 0 an 90 degrees you devide 90 degrees by the max_speed and multiply it again with the current speed:
90/maxspeed*timediff
the max speed depends on you scene.
To get a non linear transition you need a easing function like this one:
fn easeOutQuad t b c d = (
t /= d
-c * t * (t-2) + b
)
t is the current speed
b is 0 degrees
c is 90 degrees
d is maxspeed.
I attached a max9 file that does this.
I am sure the speed calculation part isn’t the smartest one.
But this is propably more physics than math …
Georg
hey Danke!
Well, i can’t open the file because I have max 8, but I’ll try to follow your instructions, oltough i have to admit, it sounds very complicated by just reading your post
easpecially the easing function.
But thank you, and if I won’t be smart enough to get it, I’ll post again
hey rdg, It’s working…you’re great :D…never tught that it would be so easy. thanks
but as you might expected…the rotation sometimes stops suddenly. and an elastic object which gets bended from the velocity, would also have a delay in getting straight, when the rotation stops. and it would bend over to the other side, and then again bend back and forth before it gets straight.
is it possible to put this into the script expression?
but as you might expected
well, I haven’t.
You could either take a look at the flex modifier and PEN’s recently published tutorials.
Or store something like a ‘average speed’ in a variable and reduce it per frame to get a delay.
Something like the well known flash-mantra for inertia
newX = x + speed
speed *= 0.9
x = newX
If you get it working, be sure to post a comment on how you solved it.
Georg
http://proforma.preset.de/spool/rdg-bendbyspeed_flex.mp4
the Flex looks promissing.
I guess to make it really bulletproof, we need to check if the speed is increasing or decreasing and switch between two easing functions or use an easing function that eases in and out.
http://forums.cgsociety.org/showpost.php?p=4334220&postcount=31
Georg
yea, this looks great. I’m actally trying it out too.
But in my scene it looks little bitdiferent. the cylinder is sitting on the plane, and the plane is not rotating on z, but on y axis
this means the flex modyfier takes also the whole rotation of the cylinder into account, not only the the bending.
but I think this could be solved easily.(first bake the bend and flex, and then link it to the plane)
I don’t know about your easing thing
but i tried to apply a edit mesh, and softselected the vertices on top, so the flex is doing more on top than on bottom. but the baking takes damn long.
will report the result
lol…it took so long because i baked a foliage :p…and it looked crapy
but here is a nice compare between baked and unbaked version.
www.megalomania.ch/capitanred/movies/flex.avi
it still looks liek rubber.
I think it would be better without the flex, but having the bend acitng like elastic tweens in flash
Interesting – I totaly misinterpreted your setup.
Maybe a pure flex solution is the way to go?
Georg
no matter. I didn’t describe it well in the first post
but I like your solution with the script controller. I just try (with my nonskills ) to use this script instead of your easing.
http://www.quasimondo.com/archives/000171.php
but I have no idea what the variables are standing for, and how the calculation works…
uuuhh…headache!! :banghead: