Occasional bouncing problem [Solved]

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Occasional bouncing problem [Solved]

Postby Tuppe » Sun Aug 22, 2010 5:53 am

I'm making a table tennis(ping pong game using Newton physics, but I'm having this odd problem that the ball doesn't always(quite often) bounce like it should be.
That problem is making the game unplayable and frustrating right now because 5 out of 10 times it just rolls after hitting the table. It would be correct when the ball bounces 25cm when dropped from 30cm. It does that 100% only when the ball hits the table straight down.
I'm using DarkBASIC Newton wrapper(1.53), but I think it can't be the physics engine that has this major problem, it must be in settings.

The ball is using continous collision
Creation code:
Code: Select all
function makeball(x,y,z,mass#,size#)
   `Create newton data for the ball
   Col = NDB_NewtonCreateSphere(size#,size#,size#)
   Body = NDB_NewtonCreateBody(Col)
   
   `Position the ball
   NDB_BuildMatrix 0, 0, 0, x, y, z
   NDB_NewtonBodySetMatrix Body
   
   `Set mass of ball
   NDB_CalculateMISphereSolid mass#,size#
   NDB_NewtonBodySetMassMatrix Body, mass#
   NDB_NewtonReleaseCollision Col
   
   `Make visual representation for ball and link to newton ball
   obj = 2
   make object sphere obj,2*size#
   position object obj,x,100,y
   NDB_BodySetDBProData Body, obj
   NDB_NewtonBodySetDestructorCallback Body
   NDB_NewtonBodySetContinuousCollisionMode Body, 1
   `Always keep ball active, and apply a gravity to ball
   NDB_NewtonBodySetAutoFreeze Body, 0
   NDB_BodySetGravity Body, 1
endfunction Body


Ball material,
friction: S=0.5 K=0.2
elasticy: 0.5

Table material
friction: S=0.5 K=0.2
elasticy: 0.94

Same in code:
Code: Select all
_Materials:
    DefaultMat = NDB_NewtonMaterialGetDefaultGroupID()
   
    BallMat = NDB_NewtonMaterialCreateGroupID()
    TableMat = NDB_NewtonMaterialCreateGroupID()
    PlayerMat = NDB_NewtonMaterialCreateGroupID()
   
    NDB_NewtonMaterialSetDefaultFriction DefaultMat, BallMat, 0.5, 0.2
    NDB_NewtonMaterialSetDefaultElasticity DefaultMat, BallMat, 0.9

    NDB_NewtonMaterialSetDefaultFriction DefaultMat, TableMat, 0.5, 0.2
    NDB_NewtonMaterialSetDefaultElasticity DefaultMat, TableMat, 0.94
   
    NDB_NewtonMaterialSetDefaultFriction DefaultMat, PlayerMat, 1.0, 0.8
    NDB_NewtonMaterialSetDefaultElasticity DefaultMat, PlayerMat, 1.0
   
    NDB_NewtonBodySetMaterialGroupID Player, PlayerMat
    NDB_NewtonBodySetMaterialGroupID Ball, BallMat
    NDB_NewtonBodySetMaterialGroupID Table, TableMat
   
    NDB_NewtonMaterialSetCollisionCallback DefaultMat, BallMat
    NDB_NewtonMaterialSetCollisionCallback DefaultMat, TableMat
    NDB_NewtonMaterialSetCollisionCallback DefaultMat, PlayerMat
return


Because a picture is worth a thousand words this scetch explains the problem better than my text:
http://i160.photobucket.com/albums/t187 ... 1282470768
Last edited by Tuppe on Sun Sep 12, 2010 3:15 pm, edited 1 time in total.
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm

Re: Occasional bouncing problem

Postby Julio Jerez » Sun Aug 22, 2010 7:49 am

unfortunally that is a bug of 1.53 tha can not be fixed.
this happen beacuse contacts are generate at some penetration, on and edge, and 1.53 does not have edge correction

only 2.0 can adress that issue.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Occasional bouncing problem

Postby Tuppe » Sun Aug 22, 2010 12:03 pm

Alright, thanks for pointing that out, seems like a dead end for this game.
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm

Re: Occasional bouncing problem

Postby Julio Jerez » Sun Aug 22, 2010 1:41 pm

you can increase the simulation rate.

I am sorry that for almost 7 years the people using DarkBasic refuses to use the new version of Newton.
They should put a message to let people know that Newton 1.53 is an old version and should no be used.
If they do not want to support Newton anymore, I beliebe it is irresponsable for then not to tell people what other alternative to use.
As I undertand Dark Basic is not free, you pay for it, they sopdul tell you what solution to use.
They do not want to use Newton, because they get funding fropm Agia to support comercial Physics Engines. They should provide you a solution because they also charge you for the engine.
If they do not, then you should consider abandone Dark Basic altogether and use something like Irrlith, Ogre, TV3d, or even Game Studio which have more active comunities.
There are many free engines with more than one physics solution outthere.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Occasional bouncing problem

Postby Tuppe » Sun Sep 12, 2010 3:15 pm

Oops, delayed answer as I thought the case was closed, but I want to clear these few things up.
Darkbasic is now free (changed about 6 months ago), and darkbasic does have quite many alternative physics engines, Sparky's Collision, DBP Collision DLL, Newton and Havok phyiscs is currently WIP. And also the PhysX, which costs money.
It would be definently superb to get the newest Newton on DarkBASIC because I think it is the most advanced physics engine of above-mentioned. But it's great that tiresius made the 1.32B > 1.53 version update couple years ago.
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 225 guests

cron