Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
animation?
#21
I just ate some burger rings Smile

anyways, this topic is old, but cos im a genius, i thought id tell you this.

You dont want inertia, you want momentum.
If you want momentum, from now on, give your objects in qbasic these variables.

S= distance from other object
U= initial velocity
V= final velocity
A= acceleration
T = time (just use the command TIMER i spose Smile)

anyways,

S= UT+1/2AT^2
A = (V-U)/T
V = -U/ (A-T)
U = V/(A-T) *-1
T = (V-U)/A
V^2 = U^2 +2AS

ok those are the formulas if you need to know what those variables are at any one time, you can do some maths and swap the equations around. ANYYYYYYYYYYYWAY.

Momentum of 2 objects hitting each other:

(M1*V1)+(M2*V2)
M= mass
V = velocity

so, just say you have Mr .Pixel travel at 3 pixels a second hit Mr. Object, who is travelling at 1 Pixel a second (in the other direction)

Mr . Pixel :rotfl: >>>>>>BANG!!!<<<<<<< :rotfl: Mr. Object

So we'd go, Mr. Pixel weighs 1 dot, and Mr. Object weighs 4 dots.

Mr. Pixel is going 3 pixels east (>>>) every second, and Mr. Object is moving 2Pixel west every second (<<).

When they hit each other, what will happen?

This could be used in games with cars, or perhaps a mario type game if an enemy rushes into you.

Well, this is what will happen, usung the equation (M1V1)+(M2V2)

(1*3)+(4*-2) = -5

because we know that Mr. Object is travelling west, (which is negative), - 5 mean that they will join together and move 5 pixel west per second!!!

I can write more about them saying wot would happen if they built up speed or if friction slowed them down, but Ill leave you with this example of a QB game to simulate this. ( Im busy eating ice cream now)

Code:
Mrobjectweight = 4
Mrobjectspeed = -1 (- becos he's going west)
MrPixelweight = 1
MrPixelspeed = 3 ( + cos he's going east)

'Load all the graphics
'Put mr object on screen, and make him go at 1 pixel west P/s
'put mr velocity on screen and make him go 3 pixels east  P/s

'when they are 1 pixel away from each other, make both of there
'speed = (M1*V1)+(M2*V2)
LA BLA BLA
Reply
#22
whoops, i made a boo boo.

Mr Object is actually having a FORCE of -8, and Mr Pixel has a force of 3, which is how i got -5 as my answer.

Someone know how to fix this up? I think you have to divide that -8 answer into 3.

Someone got ideas? lol
LA BLA BLA
Reply
#23
That's all just physics... I don't think anyone bothers about giving their objects a weight, but I think they should to make a realistic particle engine.

Task for proflex: make your formula work in 2D. I can do it, can you?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)