tease tricks 2004-01-23 - By Colin Holgate
Back The rotation control of the vanes isn't that much different from Greg's 2D sample script, only I didn't have to get into sine or Pi or anything like that. Instead I did a variation of a simple bouncing ball. With a ball falling under gravity, you start with a speed of zero, and then each frame you add 1 to the speed, and then add the speed to the vertical position. When the ball would have gone below the ground you multiple the speed by -1, but continue to add 1 to the speed (which will bring it back to zero when it peaks). To stop it bouncing forever you multiply by something other than -1, hence the .97 in Greg's example, or -.97 for the bouncing ball case.
For rotating something that needs to settle, you could do proper pendulum mathematics, but a quick approximation is to do the same speed trick as with the bouncing ball. In that case though you change from adding 1 to adding -1 to the speed after the angle passes zero, and multiply both the amount you're adding,and the speed by something a bit below 1. I didn't that with trial and error until I liked the look of it. The scripting is a bit ugly though, so I'll keep that hidden!
The cute part of the movie though is the way the vanes are connected. You can't just parent them together, because the rotation of the second one would by the rotation of the first + the rotation of the second. The third would be third+second+first, etc. To get a nice effect would take a lot of adding and subtracting. Really you want each vane to just have its own rotation to worry about. You also want the rotation point to be at the top of the vane, if not a bit higher than that.
The solution to the rotating outside of the model (there's probably an easier solution to this part of the problem, but my solution helps solve then next part too) is to have an invisible parent model and translate the vane away from that (monospaced font used here):
0 __ ____ ____ ____ ____ | | | | |__ ____ ____ ____ ___|
The 0 is the invisible model, and by rotating that the child vane part will swing nicely. That solves the swing vane part, but to solve the connecting to the next vane I made another invisible model that is also a child of the first invisible model:
0 __ ____ ____ ____ ____ | | | | |__ ____ ____ ____ ___| @
The @ swings along with the vane. Now all that's needed is to set the top invisible model to the location (but not rotation) of the previous vane's bottom invisible model. The whole of this vane is then pushed forwards, or backwards, or up or down, according to what all the previous vanes are doing at the time.
The final effect looks good, even with the basic trick being simple!
http://staff.funnygarbage.com/colin/blinder.html
<!doctype html public "-//W3C//DTD W3 HTML//EN"> <html><head><style type="text/css"><!-- blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 } --></style><title>tease tricks</title></head><body> <div>The rotation control of the vanes isn't that much different from Greg's 2D sample script, only I didn't have to get into sine or Pi or anything like that. Instead I did a variation of a simple bouncing ball. With a ball falling under gravity, you start with a speed of zero, and then each frame you add 1 to the speed, and then add the speed to the vertical position. When the ball would have gone below the ground you multiple the speed by -1, but continue to add 1 to the speed (which will bring it back to zero when it peaks). To stop it bouncing forever you multiply by something other than -1, hence the .97 in Greg's example, or -.97 for the bouncing ball case.</div> <div><br></div> <div>For rotating something that needs to settle, you could do proper pendulum mathematics, but a quick approximation is to do the same speed trick as with the bouncing ball. In that case though you change from adding 1 to adding -1 to the speed after the angle passes zero, and multiply both the amount you're adding,and the speed by something a bit below 1. I didn't that with trial and error until I liked the look of it. The scripting is a bit ugly though, so I'll keep that hidden!</div> <div><br></div> <div>The cute part of the movie though is the way the vanes are connected. You can't just parent them together, because the rotation of the second one would by the rotation of the first + the rotation of the second. The third would be third+second+first, etc. To get a nice effect would take a lot of adding and subtracting. Really you want each vane to just have its own rotation to worry about. You also want the rotation point to be at the top of the vane, if not a bit higher than that.</div> <div><br></div> <div>The solution to the rotating outside of the model (there's probably an easier solution to this part of the problem, but my solution helps solve then next part too) is to have an invisible parent model and translate the vane away from that (monospaced font used here):</div> <div><br></div> <div><tt> 0</tt></div> <div><tt>__ ____ ____ ____ ____</tt></div> <div><tt >| <span ></span> |</tt></div> <div><tt >| <span ></span> |</tt></div> <div><tt>|__ ____ ____ ____ ___|</tt></div> <div><br></div> <div> The 0 is the invisible model, and by rotating that the child vane part will swing nicely. That solves the swing vane part, but to solve the connecting to the next vane I made another invisible model that is also a child of the first invisible model:</div> <div><br></div> <div><tt> 0</tt></div> <div><tt>__ ____ ____ ____ ____</tt></div> <div><tt >| <span ></span> |</tt></div> <div><tt >| <span ></span> |</tt></div> <div><tt>|__ ____ ____ ____ ___|</tt></div> <div><tt> @</tt></div> <div><tt><br></tt></div> <div><tt><br></tt></div> <div>The @ swings along with the vane. Now all that's needed is to set the top invisible model to the location (but not rotation) of the previous vane's bottom invisible model. The whole of this vane is then pushed forwards, or backwards, or up or down, according to what all the previous vanes are doing at the time.</div> <div><br></div> <div>The final effect looks good, even with the basic trick being simple!</div> <div><br></div> <div>http://staff.funnygarbage.com/colin/blinder.html</div> <div><br></div> <div><br></div> </body> </html> __ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|