PDA

View Full Version : [Pivot] - Gravity and Force


NinjaMario
04-24-2006, 07:31 PM
Before you read: This is a very detailed tutorial, so I suggest that you read up to the part where I list the six sections of this tutorial, then look at the links and pictures to get a brief overview. At that point, if you’re still eager to understand the pictures, by all means continue! For those of you who are new to physics, I recommend that you read no more than one section per day. Theres a good two weeks of material covered in this tutorial.

Also, thoughtful comments are greatly appreciated (put plenty of time into this). I've learned what I needed from my tutorials, so I've halted the project. However, out of respect for the community, if enough people request me to continue, I will. At any rate, enjoy!

FPS = Frames Per Second (4FPS would be four frames per second)
PPF = Pixels Per Frame

Force and Gravity

Did you ever wonder why your some of your movements seem choppy and unnatural? This tutorial will show you how to simulate gravity, and apply the concept of force to make better movements. Following this tutorial might add time to your animating process at first, but becoming familiar with this concept can make it a few times faster in the long run.

(Click to see animation)
http://img288.imageshack.us/img288/5950/physicstest29oy.th.gif (http://img288.imageshack.us/my.php?image=physicstest29oy.gif)

In this animation, there are several things to explain, so I’ve divided the tutorial in to several sections:

1) Gravity
2) Breaking force into components
3) The center of gravity
4) How to catch gracefully
5) Collisions, momentum, and friction
6) Test: Where and when does physics fail in this animation?


Section 1: Gravity
(click to see animation)
http://img270.imageshack.us/img270/1438/physicstest19fa.th.gif (http://img270.imageshack.us/my.php?image=physicstest19fa.gif)

Does this look too fast? The thing is, gravity pulls at 9.8 meters per second squared. This means that after one second, the ball will have dropped (9.8 meters) * (1 second) * (1 second) = 9.8 meters. After two seconds, it will be: (9.8) * (2) * (2) = 39.2 meters. This animation shows how fast gravity looks if the stick is the average human size (1.7 meters).
To see a great example (this is my favorite animation on stickpage, created by ZACKHIX and PURECHI) of how gravity should look, try http://www.stickpage.com/ungluedplay.shtml. His physics are very impressive; it’s over 95% accurate.

Simulating gravity:
http://img270.imageshack.us/img270/764/acceleration9jr.gif (http://imageshack.us)

Simple enough pattern, right? This is how you move an object given any constant acceleration X. Starting with acceleration X, you move it down X, then 3X, then 5X, etc. For the animation above, I used a 4PPF (four pixels per frame) acceleration for the ball on the left, and a 2PPF for the one on the right. For the 4PPF, X=4, therefore it moved 4 pixels, then 12, then 20, etc. These were both done at 16 FPS for my animation above.

Eyeballing it: (This is only for either a vertical or horizontal acceleration. Acceleration at an angle is explained later.)
Acceleration is actually very easy to estimate. Without understanding anything I wrote before, you can follow just these two steps to simulate a constant acceleration:
Step 1: Move your stick the same distance as you did the previous frame (as in previously if you moved it one ball length, move it a ball length again).
Step 2: Add twice the unit of acceleration (as in if you want the acceleration to be 2PPF, add 4 pixels). Remember that even a very small movement here can have a huge result. The faster ball was only using a 4PPF acceleration at 16 FPS.
Note: What if I didn’t move my animation the previous frame? Then skip steps one and two, and just move your stick one unit of acceleration.

How do I compensate for a different FPS rate? Simple. A 4PPF acceleration at 16FPS is the same as a 16PPF acceleration at 8FPS, or a 1PPF at 32FPS. Notice the pattern? Take 16 (if you’re judging your acceleration off of my example), divide it by your frame rate, square it, then multiply it by your acceleration rate. I.E. 16/8 (my new frame rate) = 2. 2*2 = 4. 4*4(my acceleration rate) = 16.

Final note on gravity: Gravity does not depend on weight, but it does depend on a weight to surface area ratio. A bowling ball and marble will fall at the same rate, but a bowling ball and a piece of paper obviously will not. However, most objects take several seconds after a free fall to reach their terminal velocity, so you won’t need to worry about its for the most part. If you want to know how it works, think of it as a force that increases with velocity. If it takes 5 seconds to reach your terminal velocity, it means that it will take 5 seconds for air resistance to hit G (G = Gravity = 9.8 meters / second squared). A simple approach would be to make air resistance .2G at the first second, then .4, .6, .8, and finally 1. This mean your object will accelerate at 10 meters per second, then 8, 6, 4 ,2 , and finally 0. I doubt this will come up, but it’s something that plagued me for my entire first year of physics, so I thought some people might want to know how to do it.

Section 2: Breaking force into components
Look at the top middle ball in my first animation, and notice the curved pattern it makes while falling and rising. When something is in midair like that, there is only one force acting on it: gravity. That means vertically, it will follow the pattern as shown above. But what about horizontally? Since there are no horizontal forces acting on the object, it maintains a constant horizontal velocity. (Think about something in space. If you pushed something out into space, it would travel indefinitely at the same speed, unless it collided with space debris or came across some significant gravitational pull.)

http://img255.imageshack.us/img255/800/components6jd.gif (http://imageshack.us)
Remember, the horizontal component remains the same, so each time it moves some distance Y, despite the fact that the vertical movement it changes each time. The point is that you must break down your movement into two components.
Note: Generally in physics, the X component refers to the horizontal component and Y to the vertical. Sorry if this causes any confusion.

Concept question 1: If you fire a bullet horizontally, how long does it take to fall? (Answer: The same amount of time as if you dropped it. Remember, horizontal motion has no impact on vertical!)

Concept question 2: What if you shot an arrow at a 45 degree angle? Then how long does it take? (Answer: This one’s slightly more complicated. Let’s say you shoot it at 30PPF. Initially, it would travel horizontally at the same speed as it does vertically, which is roughly 21PPF vertically and 21PPF horizontally. If gravity was a 4PPF acceleration, it would travel vertically upwards 21,13,5, then downwards 3,11,19,etc. Horizontally it would travel 21,21,21,21,21,etc. until it hit the ground. If it were at an 80 degree angle, it’d be around 27PPF vertically and 13PPF horizontally. If you want to know how to do this, you need a calculator. Take sine of the angle and multiply it by the speed to find the vertical component. Take cosine of the angle and multiply it by the speed to find the horizontal component.)

Section 3: The center of gravity
This is nice and all for balls moving around, but what about making the stickmen move? This is where the center of gravity plays its role. If you shot a person out of a cannon the same way that the arrow was shot in the second concept question, his center of gravity would follow the same path of the arrow no matter what he did in mid air (air resisted neglected). The only thing you need to worry about, then, is how to find the center of gravity.

(click to enlarge)
http://img246.imageshack.us/img246/3509/cog5es.th.gif (http://img246.imageshack.us/my.php?image=cog5es.gif)
Finding the center of gravity:
The first thing that you might have noticed is that the center of gravity doesn’t need to be on the person. Unfortunately, precisely finding the center of gravity would involve a series of complex integrals, which is so incredibly not worth your while that I’m not even going to explain how to do it.
Instead, just notice that the center of gravity is just as you’d think it would be: the point at which all matter above and below that point are equal, and where the matter to the left and to the right equal. Note that matter refers to weight, not size. If you had a balloon attached to a bowling ball, the center of mass would be right next to the center of the bowling ball, but slightly towards the balloon. Continuing on, what I’ve provided are estimates as to where I think it would be given that the body segment should weigh more than the legs and arms. To be honest, you probably don’t need to worry about the weight of the segments as long as you’re consistent.

Concept question 3: If you were in mid air and someone threw a ball that would hit you on your lower stomach, how would you dodge it? (Answer: This is similar to throwing it at the blue circle on the left most stick in the picture above. If he moved his arms and legs to the left as shown in the middle stick, the ball would then completely miss him.)
Concept question 4: If you were going to jump over a bar, could you do it without ever having your center of gravity go over it? (Answer: Yes! Watch the Olympic high jump and you’ll see how it’s done. In the beginning the arms go over the bar, and then the body makes an upside down U shape, kind of like in the stick on the right. To finish off, the arms are pulled out to help rotate the body for the legs to come over without hitting it.)

Section 4: How to catch gracefully
This barely deserves its own section, but notice how in the animation on the top, the entire ground moves to catch the balls? Those balls could’ve been eggs and not have cracked because they followed these steps:
Step 1: The catcher must move at just about the same speed as what it’s catching once contact has been made. When the balls were reaching the ground, they were traveling about 50 pixels per frame.
Step 2: Once contact has been made, it must decelerate slowly enough as to not crush what it’s catching. This is actually very easy to do. Just don’t try anything crazy like a 40PPF, which for that animation would’ve been a 10G (10 times the force of gravity), deceleration.

Concept question 5: On the way up, the ground accelerated upwards at 10PPF, and then traveled at the fastest possible deceleration it could to keep the balls on the ground. How fast was that? (Answer: It had to decelerate at the speed of gravity, which was 4PPF. Doing this made it so that the balls exerted no force on the ground until it stopped decelerating at its resting point.)

Section 5: Collisions, momentum, and friction
This section deserves a tutorial in its own, so I’ll just be briefly over viewing the concepts.
Collisions: There were plenty of collisions in this animation, mostly with the balls against the ground, but also when they collided with each other. The thing the top middle ball did that doesn’t happen in real physics is that it made perfectly elastic collisions with the ground and wall. This means that it lost no energy once it struck the ground, so it bounced back with the same velocity with which it hit the ground. When the stickman fell down, he shook the ground and “physics” were turned on. After that, it lost horizontal velocity each time it hit the wall and vertical velocity each time it hit the ground.

http://img198.imageshack.us/img198/9400/bounce0ki.gif (http://imageshack.us)

Pretend your object sits on top of one of the red balls. If it bounced, the height it would reach would be the red ball to the right. Notice how the lower the ball higher the ball sits, the more distance it loses, but the velocity loss is the same. The amount of velocity it loses is actually up to you, just make sure the amount of velocity it loses is about the same each time.

Momentum: This would take forever to explain mathematically, so I’ll just provide a few concepts:
1) Everything that moves has energy, which is mass times velocity squared. This means if one object was traveling twice as fast as another object, it’d have to be 4 times as small to have the same energy. Let’s say these two objects hit each other and made a perfectly elastic collision. This means no energy was lost; therefore they’d reverse their direction, but maintain their initial speeds. With a perfectly elastic collision, they’d both stick together and completely stop moving.
2) Assume two objects had the same mass, but one was moving upwards twice as fast as the other which was moving to the right. If they made a perfectly elastic collision, they would trade directions and velocities. If they made a perfectly inelastic collision, they would both travel up-right (it would travel faster up than it would right) at a speed that was the average of the two velocities.

http://img198.imageshack.us/img198/453/collisiongif2xt.th.gif (http://img198.imageshack.us/my.php?image=collisiongif2xt.gif)
(This is a picture of two identical energies making a perfectly inelastic collision)

Friction: You might’ve also noticed that when the balls stopped bouncing, they rolled but slowed down despite not hitting anything. This is caused by a type of friction called rolling friction, which like gravity, is a force. Friction doesn’t depend on the speed, the weight, or even how much surface area is touching the ground. Friction only depends on the type of material it is: If you use a 1PPF deceleration on ice, you’d want to use a much higher, maybe 5PPF deceleration on rubber. Very high frictions will create a lot of torque on its object, and if it isn’t compensated for, can easily cause the object to flip over (think about trying to slide on ice versus sliding across your driveway). This torque is caused by the horizontal force, which is exerted below the center of gravity.

Concept question 6: In #2 of the momentum section, why didn’t the velocity slow to below the average of the two velocities? I thought the collision was inelastic, which meant 100% energy loss? (Answer: Components! One was traveling in the X direction, and the other was traveling in the Y direction. Since the X and Y directions are independent, no energy was lost. It is important to consider that the net energy will remain the same after any type of collision. If two equal energies are collide directly with each other, their net energy before the collision is 0. This is because one energy is positive and the other is equal but negative, therefore the energies cancel each other out.)

Concept question 7: What if they traveled straight at each other, one going twice as the other? (Answer: When they collide, both balls lose the energy of the first ball. This means the first ball first ball gets its speed cut in half and the second ball losses all of its speed and becomes stationary. However, the first one must now drive the second ball because they’re stuck together. With twice the mass, the speed becomes cut in half again, making the two masses traveling one fourth the speed of the faster one, in the direction of the faster one. Again, the net energy remains the same.)

Section 6: Test: Where and when does physics fail in this animation?

Well, it’s time to see what you’ve learned. Have fun!

Problems with my animation before the stickman falls:
Leftmost ball:
Most inanimate objects cannot fly. Therefore, its horizontal movement works against physics with every frame because it’s constantly accelerating and decelerating, yet no horizontal force to act upon it. Vertically, the ball accelerates and decelerates with the force of gravity. This means that vertically it is actually ok when it’s slowing down moving upwards, and speeding up moving downwards.

Bottom middle ball:
Same as the leftmost ball.

Top middle ball:
It makes perfectly inelastic collisions with the wall and ground. In fact, sometimes it even gains a little energy from the wall, as you might’ve noticed by its inconsistent landing positions.

Ball on the right:
Nothing! Physics were fine here. (granted a relatively small room for error)

Stickman:
Again, nothing was wrong. Be sure to watch his center of gravity, which follows a curved path downward. It might’ve thrown you off because contrary to what people do in real life, he chose to slightly jump off his planted foot to worsen the fall. (Again, it’s hard to precisely estimate the center of gravity, so it might be off a couple pixels here and there.)

After the stickman falls, “physics” was turned on. Or was it?:
Leftmost ball: This was fine except for one thing: When it made collisions with the ground, it was losing a fixed distance, not a fixed velocity. This is wrong because the harder it hits, the more energy it losses. However, with a fixed distance loss it actually losses more energy with the smaller hits.

Bottom middle ball: Same as the leftmost ball.
Top middle ball and Rightermost ball These were fine.


Extra Credit: A while ago, I mentioned that my favorite stickmovie was over 95% correct with the physics. Can you spot any errors? (http://www.stickpage.com/ungluedplay.shtml)
Most inconsistencies in physics were with gravity, but were done for effect, which worked beautifully. For that reason I’m going to provide two hints:
Hint #1: Who they are
a) The green colored guy who is the last to get hit with the sword.
b) The white colored guy with the charge gun who kills the guy with the sword.

Hint #2: When they did it
a) The last time he used his zip cord
b)The second time he fires the gun

Answers:
1) The last time he used his zip cord, he traveled directly to it. However, that could only happen if the force driving him upwards was the same as the force driving him to the left. There are two forces in play: 1 was gravity, the other was the pulling of the cord. Since the cord was a force at an angle, it had both a vertical and horizontal component, whereas gravity has a vertical component in the opposite direction. Since there was no horizontal component to counter that of the zip line, the only way to move straight to it would be if his zip cord was shot at greater than a 45 degree angle to compensate for gravity. Since it wasn’t, he should’ve been accelerating more to the left, which would’ve caused him to rotate to the left as he moved upwards.
2) Same concept. Firing the gun at an angle gives him two components of force. The only way he could remain suspended in one spot would be to fire straight down. Since it was angled to the left, he would’ve started accelerating to the right.


Conclusion: It doesn’t matter if you missed most of the concepts in this tutorial. Just remember this one rule: Force is the only thing that can change motion. When you walk, run, jump, punch, or kick, remember that your movements must accelerate, so the first movement is always a small one, and should have a steady increase until it reaches its top speed. Also, when you are in mid-air, the only force that’ll be on your character 90% of the time will be gravity, so the horizontal speed of your center of gravity can’t change.

SpaceBar
04-24-2006, 07:50 PM
good job
ill read it all later

1.Shot.1.Kill
04-25-2006, 05:08 PM
You work hard on your tutorial ninja goodwork.

52xM
04-26-2006, 01:24 AM
damn! that's a darn lot of text you have there.
.................................................. ................
And damn, that's accurate. I read over 80% of it, and i have to say......


Good Job!

Hydrogen
04-26-2006, 08:32 AM
<3


That was great, man.

I'm studying that stuff in school right now.

NinjaMario
04-27-2006, 09:58 PM
Thanks for the comments! It really means a lot considering the amount of time it took to write.

Also, I can't even tell you how much writing this tutorial helped me with my current animation. It'll probably take a couple weeks before I can post any progress I've made (took 4 days just to create the sticks, level design, and music), but I can promise you it'll be unlike anyone's 9th animation you've ever seen. I hope it helps you just the same, and make sure to pm me if you have any physics questions.

Poutine Salad
04-27-2006, 10:00 PM
Wow. Just. WOW!

SpaceBar
04-28-2006, 10:42 PM
Thats what you get when you spend ages on something.

Paperclip
04-29-2006, 08:29 PM
Very good tutorial... moved into the Official Pivot Tutorial Forum.

w@t3rb0y
04-29-2006, 09:13 PM
dude man, omg im just speechless.

Fear Marine
04-30-2006, 04:10 AM
nice, i read it all. mind if i use this in science? =P

OGrilla
05-04-2006, 04:05 PM
This tutorial was one of the best I've ever read. Very indepth and you explained yourself well. I have to start taking most of that stuff into account when I animate. Thanks for the physics lesson, NinjaMario!

gema
05-05-2006, 01:00 AM
Great effort ninja.

Very nice tutorial.

pvtfight or die
05-30-2006, 01:48 PM
it looks like a textbook format to me with the diagrams

Lgolos
05-30-2006, 03:20 PM
That's truly incredible, the amount of detail and depth you went in to was beyond any other tutorial I've read here.

Unfortunately, many people will not have the patience and/or intelligence to read and/or understand much of it, which is a shame, since I can see you put a lot of effort in to it.

There's no errors as far as I can tell in the physics and very few errors in the test animation, and even those are trivial. However, for improvement's sake, I'll go ahead and list them.

1. The ball to the far right seemed to stop a bit too suddenly in the first part of the animation, as if it lost some of its elasticity; it seemed to change from a tennis ball type thing to more of a baseball when the man came in.
2. The man who walked in stopped at a bit of an awkward position, and the movements in his head were a bit jerky.
3. After the man falls, the ball on the far right seems to bounce a bit too high on one of the bounces. I also see it bouncing in the air one frame, although that might just be me.


My complaints, if you want to call them that, are few and unimportant. I congratulate you on one of the most useful tutorials here, pivot and otherwise.

leedon
06-10-2006, 09:38 PM
PHENOMINAL,BEST,AMAZING,AWSOME,OMFG!,STARSHOOTING. ect. And other words to discribe your tutorial.

Also UNGLUED is one of the best stick animations ever. I seen it 26 times.

Also i have an ani testing what i crammed in my small brain from your tut.



http://img113.imageshack.us/img113/1032/bounce2hv.gif

sorry its tiny

SSChibi
06-10-2006, 10:41 PM
Most of it is helpful for animation. And it's all helpful for my upcoming Physics class. Thanks! No but really, nice tutorial.

Ninja Stick2
06-10-2006, 10:53 PM
meh the ball on the right went up way to high on the first bounce

MM-The-One
06-18-2006, 01:33 PM
WoW i Must Say That Was Making Ma lil' peanut Brain Work Hard O.o very Nice

yodamvpplayer
06-18-2006, 10:17 PM
Perfect in pretty much everyway but i highly doubt that any animator on stickpage (since i believe most of themare in middle school) would know about cosines and sines and that crap...UNLESS THEIR STOOPID MATH TEACHER WAS RETARDED ENOUGH TO MAKE THEM DO A TEST ON IT THE LAST WEEK OF SCHOOL JUST FOR FUN!!! grrrrr p.s. i hate 7th grade and am glad its over (:

pi3
06-19-2006, 01:32 PM
this tut hurt my brain! but also helped me out good tut!

brandino
10-23-2006, 02:34 PM
Wow thats pretty good

Slayer
10-24-2006, 04:23 AM
Wow, VERY well thought out, and explained in-depth.

Awsome job.

NCz
10-21-2007, 09:18 PM
that was amazing how much time did u spend on it? but that doesnt matter it doesnt only have to be for pivot it works in every animation ive done some test s with it and it theyve turned out really well good tut. btw yodamvpplayer im in 7th grade and it sux...

Dax
11-03-2007, 05:54 PM
hey i made a vid

http://img464.imageshack.us/my.php?image=balls2zw8.gif

mr.mcstick
12-16-2007, 09:45 AM
Good tutorial I love unglued battle one of the best movies on stickpage

Pnuts
09-21-2008, 01:47 AM
Really damn great.

Arkehy
09-26-2008, 07:45 PM
Just amazing in everyway, you deserve a pat on the back for all of the effort put into this one tutorial.

axerman1001
10-26-2008, 07:13 PM
Wow good job, and I don't even do pivot. Lol.

DaJack
11-12-2008, 02:06 PM
Great tutorial. x)

Mki10
11-15-2008, 04:03 PM
Really Really good job that helped me alot thanks

insanesk8er!!
09-05-2009, 05:05 PM
DAMN! That is long! But I read it in two days and it's very good

Sonic Youth
12-27-2009, 10:07 PM
wow i like its very in depth...i like it

Sorage55
01-25-2010, 08:29 PM
Great tut man. I'm a natural at falling characters as well!