Hey,
I'm trying to simulate two steel balls, same size and mass, hanging from strings colliding with one another. One ball is at rest and the other hits it. What I'd like to happen is that when the moving ball hits the at rest ball it transfers its speed to the other ball and stops moving. At the moment the ball that collides continues to move but a bit slower. Any suggestions would be appreciated.
simulating steel ball collision
-
- Posts: 3
- Joined: Tue Feb 16, 2010 2:00 pm
- Contact:
simulating steel ball collision
Last edited by drcCoder on Tue Feb 16, 2010 4:24 pm, edited 1 time in total.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: simulating steel ball collision
Do the collision shapes have 1.0 for their elasticity? You will also need a lot of iterations to simulate this well.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 3
- Joined: Tue Feb 16, 2010 2:00 pm
- Contact:
Re: simulating steel ball collision
This is where I set up the values for the ball sprites
And these are the value set for the space they're in
Code: Select all
mySprite.position = ccp(x,y);
myBody = cpBodyNew(100.0f, cpMomentForCircle(100.0f, 0.0f, 25.0f, CGPointZero));
myBody->p = ccp(x, y);
cpSpaceAddBody(game->space, myBody);
myShape = cpCircleShapeNew(myBody,25,CGPointZero);
myShape->e = 1;
myShape->u = 0;
myShape->collision_type =1;
Code: Select all
space->gravity = ccp(0, -15000);
space->elasticIterations = 0;
space->iterations = 20;
space->damping = 0.85;
-
- Posts: 3
- Joined: Tue Feb 16, 2010 2:00 pm
- Contact:
Re: simulating steel ball collision
So, would anyone have any suggestions on how to make this work better.
Who is online
Users browsing this forum: Heise IT-Markt [Crawler] and 16 guests