Ball bouncing on edges, tunelling

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Ball bouncing on edges, tunelling

Postby Enjo » Sat Jun 20, 2009 8:03 am

Hello.
I'd like to use Newton for a minigolf simulation in 3D GameStudio, using VeT's Newton wrapper. The wrapper works by adding meshes of models with certain flag set, as faces to Newton. Unfortunately I've stumbled upon a serious problem. Suppose my level is created from blocks or models like in this test case:

http://www.elwico.pl/~ender-sz/work/minimal.src.zip

The archive includes all sources and a release version, if you haven't got GS7. The main script is minimal.c; newton_* are the wrapper files.
Z pushes the ball

My expectations are that the ball rolls normally on those adjacent models, without bouncing from their edges, and doesn't tunnel through the final model - lifted a bit to act as a wall. The latter is achievable by enabling continuous collision mode, but still is not 100% secure (and probably will never be exactly 100% as far as I understand physics engines, but let's say I'd like it "even more secure").

From reading your forum, I learned that what also helps with fighting with the tunnelling, is updating Newton much faster than the game engine's FPS. The question is - will it also help with bouncing-on-edges problem? Also, can using Newton's double float instead of float version help with this issue?

An important thing to mention is that I'm still using version 2.00, because this is the only version which is supported by VeT's GS7 wrapper. If the edges bouncing problem has been addressed in new releases (has it?), I'll happily betatest it, but first we must rework the wrapper. I could also improve the test case, like adding a debug message, repositioning of the ball, or anything you like.

Cheers,
Enjo
Enjo
 
Posts: 5
Joined: Sat Jun 20, 2009 7:51 am

Re: Ball bouncing on edges, tunelling

Postby Dave Gravel » Sat Jun 20, 2009 8:56 am

Download new sdk,
http://www.newtondynamics.com/downloads ... n-2.02.rar
http://www.newtondynamics.com/forum/vie ... 22&start=0

This version have a fix about edge and rolling objects.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Ball bouncing on edges, tunelling

Postby Enjo » Sat Jun 20, 2009 9:10 am

Thank you very much, Dave. I'll try it and report back.
Enjo
 
Posts: 5
Joined: Sat Jun 20, 2009 7:51 am

Re: Ball bouncing on edges, tunelling

Postby Enjo » Sat Jun 20, 2009 12:41 pm

Unfortunately the bouncing problem doesn't seem to be fixed in my case. Here's the newest test case, with v. 2.02 and the newest VeT's wrapper:

http://www.elwico.pl/~ender-sz/work/min ... 02.src.zip
Would you like a debug console for this?
As before, Z pushes the ball.
One thing to note is that the ball rotates very fast after a collision with the final wall (F12 shows axes) , probably because of too low ground friction. Maybe this could be the problem?
Enjo
 
Posts: 5
Joined: Sat Jun 20, 2009 7:51 am

Re: Ball bouncing on edges, tunelling

Postby Julio Jerez » Sat Jun 20, 2009 1:34 pm

Enjo wrote:Hello.
From reading your forum, I learned that what also helps with fighting with the tunnelling, is updating Newton much faster than the game engine's FPS. The question is - will it also help with bouncing-on-edges problem? Also, can using Newton's double float instead of float version help with this issue?


to simulate a golf ball that fast you will need to run at 300 or highet fps, continue collision is not something that will make the quality of the phsyics better,
Continue collision provent the body from interpenetrating oteh body by moving teh body ahead and see if if find contacts but that motion in a linear prejection whit is when is cassing teh ball hitting and edge.

You cannot simple simulate such small object at such high velocity at a low FPS.
Try running the phyiscs at 300 fps an see if it is better?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ball bouncing on edges, tunelling

Postby Enjo » Sat Jun 20, 2009 2:31 pm

OK, thanks for the answer.

I must be sure if we understand each other correctly though. By saying "edges" I mean the visible (yet connected) gaps between the meshes on the floor.
[EDIT]
Here's a screenshot, if you haven't had time to run the test case:
Image

If we're talking about the same thing then please correct me if I'm these hypotheses are wrong:
- Continuous collision helps to prevent body from going through other, vertical walls, but...
- ...continuous collision also makes the ball bounce on edges (?)
- Increasing FPS will help in both reducing probability of bouncing on edges, and of penetrating walls.

I will need to make some effort for calling the engine as fast as possible - I'll do it with a C++ plugin, using Boost::Thread, therefore hogging only one CPU. Normally I'd call the Sleep function in the other thread, but AFAIK the lowest time granularity in Win is 10 ms, so calling Sleep(10) would give me only 100 FPS instead of 300 FPS.

Hope to hear from you again.
Enjo
 
Posts: 5
Joined: Sat Jun 20, 2009 7:51 am

Re: Ball bouncing on edges, tunelling

Postby JernejL » Sat Jun 20, 2009 3:59 pm

you could simply call newtonupdate twice or more times per update to speed up simulation time
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Ball bouncing on edges, tunelling

Postby Julio Jerez » Sat Jun 20, 2009 4:23 pm

you just do this

Code: Select all
//updateting at 300 fps

#define STEP = 1.0f / 300.0f;
boid update (int dt)
{
    n = int (dt * STEP) + 1;

   float subDt = dt / n;
   for (int i = 0; i < n; i ++) {
          NewtonUpdate (world, subDt);
  }
}
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Ball bouncing on edges, tunelling

Postby Enjo » Sun Jun 21, 2009 5:43 am

Thank you very much! A brilliant idea. I had set FPS to 1000 and haven't noticed any bouncing, nor tunnelling so far.

Just for the record, if you multiply the dt by STEP, then the STEP should be inverted, plus dt should be a float I think, just like that:


Code: Select all
//updating at least at 1000 FPS

float newtonFPS = 1000;
void update (float dt)
{
   int n = int (dt * newtonFPS) + 1;

   float subDt = dt / n;
   for (int i = 0; i < n; i ++) {
          NewtonUpdate (world, subDt);
  }
}


Thanks again.
Enjo
 
Posts: 5
Joined: Sat Jun 20, 2009 7:51 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 3 guests