# bouncing ball using Newton?

This topic is 4294 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm stumped. What's the trick to making a bouncing ball using Newton? Currently, my ball falls to the floor, rattles a bit, then stops. No real bounce. I set the body elasticity to 1.0. Am I misunderstanding the use of this parameter?

##### Share on other sites
What's the code you're using? We'd probably need to see that before we find out what's going on here.

##### Share on other sites
Quote:
 Original post by GowerlypuffWhat's the code you're using? We'd probably need to see that before we find out what's going on here.

I'm guessing that he is using the Newton physics engine. Although I was as confused as you at first [smile] EDIT: Sorry, maybe you were aware of that point ^^ I should probably go to sleep...

I've never used the Newton physics engine so can't help you there.

##### Share on other sites
Oops. I assumed that Newton was a household name around here. The physics engine I'm using is "Newton Game Dynamics v1.53".

BTW, I was able to solve the bounce problem. If anyone cares, you just need to add a callback something like this:

NewtonMaterialSetCollisionCallback(nWorld, id, id, NULL, NULL, HitMe, NULL);....//-----------------------------------------------------------------------------int _cdecl HitMe (const NewtonMaterial* material, const NewtonContact* contact){	float pos[3];	float norm[3];	float dir0[3];	float dir1[3];	float speed;	float tan_speed0, tan_speed1;	NewtonMaterialGetContactPositionAndNormal(material, pos, norm);	speed = NewtonMaterialGetContactNormalSpeed(material, contact);	speed *= 1.9;	norm[0] *= speed;	norm[1] *= speed;	norm[2] *= speed;	NewtonAddBodyImpulse(rigidBodyBox, norm, pos);	tan_speed0 = NewtonMaterialGetContactTangentSpeed(material, contact, 0);	tan_speed1 = NewtonMaterialGetContactTangentSpeed(material, contact, 1);	NewtonMaterialGetContactTangentDirections(material, dir0, dir1); 	tan_speed0 *= -0.5;	tan_speed1 *= -0.5;	dir0[0] *= tan_speed0;	dir0[1] *= tan_speed0;	dir0[2] *= tan_speed0;	dir1[0] *= tan_speed1;	dir1[1] *= tan_speed1;	dir1[2] *= tan_speed1;	NewtonAddBodyImpulse(rigidBodyBox, dir0, pos);	NewtonAddBodyImpulse(rigidBodyBox, dir1, pos);	return 1;}

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5
khawk
11

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013301
×