Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-04-2003, 09:34 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Post 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

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) )


Next up, momentum (dealing with collisions) and Projectile movement
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #2  
Old 09-04-2003, 11:18 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
nooo please no more, I've just been looking at that stuff in my exams =x
__________________
Former Global Scripting Team Member


Reply With Quote
  #3  
Old 09-04-2003, 11:34 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.

Reply With Quote
  #4  
Old 09-05-2003, 01:33 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Weee!!!!!
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #5  
Old 09-05-2003, 03:41 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Reasonably understandable.
Reply With Quote
  #6  
Old 09-05-2003, 06:43 AM
Falados Falados is offline
Cucumber NPC
Falados's Avatar
Join Date: Jan 2003
Posts: 141
Falados is on a distinguished road
Send a message via ICQ to Falados Send a message via AIM to Falados
ah, refreshing my mind of those nice trig functions I learned in Geometry (as well as simple vector math)
__________________

subliminal message: 1+1=3
Reply With Quote
  #7  
Old 09-05-2003, 10:05 PM
Benm00t Benm00t is offline
I made a tree!
Benm00t's Avatar
Join Date: Jul 2003
Location: The Intarwebbernetwork!
Posts: 987
Benm00t is on a distinguished road
rah so many Math and Science related posts here now :-o
Reply With Quote
  #8  
Old 09-05-2003, 11:33 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
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.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #9  
Old 09-06-2003, 02:39 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
//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

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.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial

Last edited by Dach; 09-06-2003 at 06:09 PM..
Reply With Quote
  #10  
Old 09-09-2003, 06:29 PM
Sheepiroth Sheepiroth is offline
Registered User
Join Date: Sep 2003
Location: NY
Posts: 15
Sheepiroth is on a distinguished road
Send a message via AIM to Sheepiroth
Smile

Hm, this thread may be useful ::adds to favorites list::
__________________
Delteria 4 lyf
Reply With Quote
  #11  
Old 09-17-2003, 05:55 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally posted by Sheepiroth
Hm, this thread may be useful ::adds to favorites list::
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
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:16 AM.


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