Physics improvement

Everything about development and the OpenMW source code.
User avatar
ElderTroll
Posts: 499
Joined: 25 Jan 2012, 07:01

Re: Physics improvement

Post by ElderTroll »

I know that I should wait until this is tested and confirmed to work, but AWESOME JOB Jhooks! Will that make it into 0.12.0 or 0.13.0?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Physics improvement

Post by Zini »

0.13.0. We don't accept anything new or possibly disruptive (as in: can introduce new bugs) for 0.12.0.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Physics improvement

Post by sirherrbatka »

Congratulations jhooks!

@Zini Debian FTW! ;-)

Ok, as I said I did two very long falls. I dropped my character from the height of 350280,82 units and 561547,82 units next (around 5 km and 8 km).

The falling time was 1 minute and 27 seconds at first test and 2 minutes and 23 seconds second time.

After calculations I found speed cap 3772,625 units/second (around 3770) and g is (suprise!) equal 645,1098 units/second^2. That's just 9,16056 m/s^2.

Since the heights was so freaking big I think that this numbers are accurate.

PS
Don't try this at home! ;-)
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Physics improvement

Post by jhooks1 »

Gus, is this the right way to do things?
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Physics improvement

Post by jhooks1 »

Physic.cpp is in openengine, so do I have to commit it to openengine instead of openmw?
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Physics improvement

Post by jhooks1 »

Changed it to internalCollisionShape = new btBoxShape(btVector3(14.64f * 2, 14.24f * 2, 33.25f * 2)); Found the xyz in base_anim.
Seems to work better, I think aedras coordinate system is different which is why the coordinates were in a different order.
Tarius
Posts: 574
Joined: 24 Oct 2011, 19:29

Re: Physics improvement

Post by Tarius »

Ok, so I first just decided to check the end numbers to see if they were about right, they were not really, so one thing led to another and now this:
I may not be a coder, but I did minor in physics.

~0.142876729 internal game unit to decameter(.1m) multiplication factor
I left off the back digits as it only makes a ~.0002 difference.
Game units are multiplied by this number.
You can also go by 64 units/yard or ~70 units/meter. This 70 units/meter is verified both on the Morrowind and Oblivion wiki.
0.0142876729 is used here to make things in meters instead of a tenth of a meter.

A. 350280.82 units; 87 seconds

B. 561547.82 units; 143 seconds

Step 1
A. 350280.82*0.0142876729 = 5004.697779, so ~5004.7m

B. 561547.82*0.0142876729 = 8023.21157, so ~8023.2m

Step 2
Average Velocity
A. 5004.7/87 = 57.5253m/s
B. 8023.2/143 = 56.1063m/s
This is close so I think its accurate enough.

Average of A and B = 56.815m/s
in units, this is 56.8158*70 = 3977.11u/s

56m/s is actually about the terminal velocity of a person in real life.

Distance needed to reach this speed:
56^2/(2*9.81) = 159.837m

Time taken to reach this distance:
(2*159.837/9.81)^.5 = 5.7085 seconds

So, if anything 9.0 or more was used, it only takes about ~6-7 seconds to get to max speed.
This is under 10% of the total time for A and B which means that the speed shouldnt vary anywhere above 1% from the average.


So, looking at the numbers below, I am perplexed:

3772.625*0.0142876729 = 53.9020m/s
3772.625/70 = 53.8946m/s

645.1098*0.0142876729 = 9.21709m/s
645.1098/70 = 9.21585m/s

645.1098/9.16056 = 70.4225
which does not equal 70

So, my question is, exactly what calculations did you do?
Unless you have access to air resistance, mass, density and drag...
Just want to make sure gravity gets done correctly. Please forgive the use of decimals instead of commas, why they are switched comparing the US to Europe I have no idea.
User avatar
hircine
Posts: 157
Joined: 06 Aug 2011, 07:18

Re: Physics improvement

Post by hircine »

I shall not forgive you for using Decimals. I SHALL THANK YOU.

everyone should be using decimals :P
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Physics improvement

Post by sirherrbatka »

It's simple. Let S1 would be distance in first jump, S2 in second, Vm maximum velocity, a acceleration value, t1 total time in first one, t2 total time in the second one, ta time of acceleration phase.

S1=Vm(t1-ta)+1/2(a*ta^2)
S2=Vm(t2-ta)+1/2(a*ta^2)

but Vm is nothing else but ta*a, this leaves just two unknowns to be calculated. Anyway: in the end we have:

Vm=(s2-s1)/(t2-t1)
a=Vm^2/(s1-Vm*t1)

As you can see no problem here at all. Just pure Newton's dynamics.

PS
everyone should be using decimals
For comas we shall kill and die! ;-)

PPS
Just checked it. there is something not right.

PPPS
I think that the height was just to big (like 2 times to big) and something bad happend because of float point.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Physics improvement

Post by Zini »

Physic.cpp is in openengine, so do I have to commit it to openengine instead of openmw?
Correct. You need to fork openengine on github. Add your fork as a remote to your local repository (after cd-ing into it). Then it is mostly business as usual. But after you done committing/pushing and have cd'ed back from the submodule directory to the OpenMW directory, do another commit so OpenMW is using the new version of the submodule.
Post Reply