Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   A little physics a little at a time (https://forums.graalonline.com/forums/showthread.php?t=47692)

Dach 09-04-2003 09:34 PM

A little physics a little at a time
 
(I will capitalize Vector quantities)
//Acceleration\\
Simply put, Acceleration is the change in speed of an object. It can be calculated as Velocity/time. Since Velocity is a vector quantity (speed with direction), Acceleration is a vector aswell, which really just means that it can go forwards or backwards. So don't say decellerate, just say negative Acceleration.

A good example would be gravity, as something falls it increases speed (neglecting air resistance) by 9.81 meters/sec(32.2 ft/sec) every second. In graal this is roughly adding/subtracting .1 to your speed every .05 seconds.

//Forces\\
A Force, of course, is a push or pull on an object. To make things simple we normally look at objects as a point, so don't worry about where the force is acting on an object just yet. Forces are measured in Newtons and are found by taking mass*Acceleration (this means that the amount of Force needed to make an object move with an accelleration is found by multiplying that acceleration by the objects mass). Forces are vector quantities aswell, so they can be broken down into their dimemsions. Lets say Force 1 is 1 N, when we break it down we find that Force1 x is .7 and the same goes for Force1 y. This is because Fx = F*cos(ang) and Fy = F*sin(ang), where F is the main Force, Fx and Fy are the components, and ang is the angle of theForce
http://www.members.aol.com/michaelangelo36/forcedia.gif
Now if more than one Force is acting upon an object, the Forces can be added. This is done by adding their component vectors (x,y, and z as needed). In the diagram, F1 and F2 are both 1N, but when you add their component vectors, you end up with a resultant Force of 1.4 N at 3pi/2 radians (270 deg). To find the resultant angle, you just need to find the inverse tangent of the resultant Force's components ( arctan(Fry/Frx) )
http://www.members.aol.com/michaelan.../rforcedia.gif

Next up, momentum (dealing with collisions) and Projectile movement

Ningnong 09-04-2003 11:18 PM

nooo please no more, I've just been looking at that stuff in my exams =x

DustyPorViva 09-04-2003 11:34 PM

Heh, this is pretty useful for someone who isn't going to be taking physics.

I'm going to be reading up in this thread, teaching myself.

:)

adam 09-05-2003 01:33 AM

Weee!!!!!

protagonist 09-05-2003 03:41 AM

Reasonably understandable.

Falados 09-05-2003 06:43 AM

ah, refreshing my mind of those nice trig functions I learned in Geometry (as well as simple vector math)

Benm00t 09-05-2003 10:05 PM

rah so many Math and Science related posts here now :-o

adam 09-05-2003 11:33 PM

Quote:

Originally posted by Benm00t
rah so many Math and Science related posts here now :-o
Yes, so scripter wannabe's will realise, Math and Science are helpfull, if not essential to scripting.

Dach 09-06-2003 02:39 AM

//momentum\\
Momentum is just an objects Velocity combined with it's mass, Momentum = mass*Velocity. There isn't much use for it, except when things hit other things. Which is of course the coolest thing about physics ;). I'll explain the three types of collisions. First is a perfect collision, where the object hitting the second object becomes part of the second and they both move on at the same speed as the first was initially (likeliness = poor, what with friction and inertia and all that). Second is um, well I forget the name of it, but this is when the first object stops and the second moves on with the first's initial velocity (think pool). The third, imperfect I think, is when both objects travel off in opposite directions in different Velocities.

//Simple Motion\\
Simple motion is the motion of an object in one direction. It deals with Velocity (distance/time), time, distance (or delta(triangle)x, meaning change in x), and acceleration. We use these formulas derived by Galileo in most calculations. Vi and Vf are the initial and final velocities for whatever part of the motion you are looking at.

dist = Vi*time + (1/2)A*time^2
Vf = Vi + A*time
Vf^2 = Vi^2 + 2A*dist
http://members.aol.com/michaelangelo36/smotdia.gif
Let's look at the motion of a car going from one stop light to another. The car starts out at 0 m/s, it then accelerates to about 5 m/s (25 mph ?) in 4 meters, he then travels for about 5 seconds then has to accelerate to 0 m/s in 2 meters (didn't see the truck in front stop). How much time, and how far did the car travel? First off, we break this into 3 parts, here's the first part;

The car starts at 0 m/s, and ends up at 5 m/s in 4 meters, so we know Vi, Vf, and dist. We want to know the time and dist, but we already know the distance for this one. So we will want to use the second equation, but we don't know the acceleration so we will use the third to find that first. We then use the calculated acceleration to find the time (this is not recomended since if you use a calculated value to find another value, your values will have a better chance of being wrong, but we didn't have much choice in this situation). Now on to the second;

Now the car is moving at a constant rate, 5 m/s, for 5 seconds. So all we need to know is, how far did the car travel? We use the first equation since it has all of our variables in it. Since acceleration is zero in this case the (1/2)A*time^2 cancels out. So uh, next part;

Now the car has an initial velocity of 5 m/s, final velocity of 0 m/s, and a distance of 2 meters, so we need to find time. We need acceleration this time so we do the same as we did in the first part.

Now we know all the times and distances for each part of the motion, so we just need to add them up to find the answer.


up next - projectile movement, it may take awhile since I'll probably try to explain alot on this...

Edit: forgot about collision types, d'oh!
Edit2: I realized that I screwed up the momentum problem and that what I was trying to show was a bit more complicated than basic physics so I'll leave momentum with the definition and give you simple motion to ease the pain of projectile movement.

Sheepiroth 09-09-2003 06:29 PM

Hm, this thread may be useful ::adds to favorites list:: :D

GoZelda 09-17-2003 05:55 PM

Quote:

Originally posted by Sheepiroth
Hm, this thread may be useful ::adds to favorites list:: :D
I thought so to when i looked at it. Didn't add to fav's though.

Dammit, i really need to get better at maths... Thirteen years here, i need Trig... XD


All times are GMT +2. The time now is 05:25 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.