cenkguzelis / jbox2d

Automatically exported from code.google.com/p/jbox2d
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Inaccurate physics #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Run the varying restitution demo using the source and testbed from: 

svn http://jbox2d.googlecode.com/svn/tags/jbox2d-2.1.2.0/

Tried different settings including 10, 20, 50, 100 iterations for position and 
velocity. all tried at 60 Hz, 100 Hz and 150 Hz.

What is the expected output? What do you see instead?
Expect the circle with restitution 1.0f to bounce back to its original height.
See the circle bouncing higher and gaining energy over time.

What version of the product are you using? On what operating system?
2.1.2, using Windows7, ran in eclipse. with Java 6.

Please provide any additional information below.
Also tried the JAR, got the same result.

Original issue reported on code.google.com by seraphth...@gmail.com on 4 Aug 2011 at 1:44

GoogleCodeExporter commented 9 years ago
hmmmmmm looks like the original engine exhibits this behavior as well.  
Probably due to floating point.  If you're having issues with this, then I 
would try setting the restitution to something slightly below 1.

Feel free to file this bug under the main box2d project, but if the issues are 
coming from floating point calculations like I suspect, then there really isn't 
a fix for this.

Original comment by toucansa...@gmail.com on 6 Aug 2011 at 5:31

GoogleCodeExporter commented 9 years ago
This behavior isn't always present. For example, it is not in the demo on 
JBox2d's website.

http://www.jbox2d.org/v2demos/index.html

I believe the version in the demo is 2.0. If it is , then the behavior is 
introduced in 2.1.

Original comment by seraphth...@gmail.com on 10 Aug 2011 at 8:37

GoogleCodeExporter commented 9 years ago
Did a test by converting all the floats to doubles in the engine. The behavior 
still remains. I doubt it is due to floating point rounding since the variation 
is rather pretty large and visible.

Original comment by seraphth...@gmail.com on 10 Aug 2011 at 8:41