Author Topic: gravity  (Read 963 times)

0 Members and 1 Guest are viewing this topic.

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
gravity
« on: August 12, 2007, 01:02:51 pm »
I got a problem not so easy to overcome I think:
What are the units for velocity in soldat - like the velocity used in CreateBullet and in GetPlayerStat?  I need this to also figure out the units for gravity.  Time I assume is measured in seconds.
I'm actually good in physics, but I can't seem to find any (accurate) tests to figure these out!
Hopefully MM himself can help me out with this...
Can't think of anything original to put here...

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: gravity
« Reply #1 on: August 12, 2007, 08:48:28 pm »
I forget offhand; I think the speed in weapons.ini is pixels/frame * 100 or something. (So a value of 300 would be 3 pixels/frame, or 180 pixels/second) I would need to doublecheck though.

Gravity differs from players to bullets; for players I believe it's 0.06/frame and bullets are 0.015/frame, but I don't remember offhand.


If you are planning on trying to do trajectory calculations, bear in mind that over long distances it will become exponentially less accurate because of the way soldat calculates velocities. And the formula used to calculate such things, to solve for useful information for trajectories, is a few printed pages long. And slow to calculate.

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: gravity
« Reply #2 on: August 13, 2007, 09:17:43 am »
i assume a pixel is the unit used in Polyworks as well as when using a getxy function in the script...
How many frames per second are there?  Because I notice the (graphical) fps in the game varies and the server prolly has its own fps configuration...  I'll run some tests soon to verify the .015 number.
Thnx for your input.  Btw, where did you get those numbers?
Can't think of anything original to put here...

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: gravity
« Reply #3 on: August 13, 2007, 07:13:38 pm »
60 frames/second (simulation rate, not graphical drawing rate). Some of the numbers I estimated myself, some I found out by asking people.

BTW, the formula used to calculate position after n frames(n > 0) is something like:

p(n) = p(0) + v(0) + (v(0)*(d^(n) - d)/(d - 1)) + (f/(d - 1))*((d^(n+1) - d)/(d - 1) - n*d)

This may be incorrect, as I'm pulling partly from memory and partly from a broken version I made, since I can't find my correct version. This is done independantly for X and Y, only for X the value of f is 0, while for Y it's the value of gravity. d is a dampening value.

Formula for velocity after n number of frames (n>0) is something like:
v(n) = (v(0) * d^(n-1)) + f * ((d^(n) - d)/(d - 1))

Again, going off some old broken stuff + memory to fix it, so might not be 100% correct.

Yes, Polyworks uses pixels.