A body with infinity mass and infinity moment of inertia and 100 velocity collide with a normal ball.
I do not want the infinity body's velocity affect the normal ball, what should I do?
Thanks.
How to disable affection of a body's velocity in collision?
-
- Posts: 6
- Joined: Fri Jan 07, 2011 4:26 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to disable affection of a body's velocity in collision?
If you just want them to pass through each other, use the layers or group properties of their shapes to filter out the collision. You can also reject the collision from the begin or pre-solve collision callbacks.
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: 6
- Joined: Fri Jan 07, 2011 4:26 am
- Contact:
Re: How to disable affection of a body's velocity in collision?
Just hold that question.
I have a new question
what is the role v_bias and w_bias?
A ball body just add to space(has some static shapes) once which never destroy until application quit. I want to predict the movement of the ball.
I just did these every round.
but it seemed to be different every round, and I found v_bias was not cpvzero since second round.
How can I make the movement of the ball the same after I set the same original position, zero velocity, zero angle, zero angle velocity every round.
Thanks.
I have a new question
what is the role v_bias and w_bias?
A ball body just add to space(has some static shapes) once which never destroy until application quit. I want to predict the movement of the ball.
I just did these every round.
Code: Select all
cpBodyResetForces(pBall);
cpBodySetPos(pBall, vect);
cpBodySetVel(pBall, cpvzero);
cpBodySetAngle(pBall, 0.0);
cpBodySetAngVel(pBall, 0.0);
How can I make the movement of the ball the same after I set the same original position, zero velocity, zero angle, zero angle velocity every round.
Thanks.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to disable affection of a body's velocity in collision?
The "bias" fields store values used by the overlap solver. Chipmunk holds a lot of internal state like this and more that cannot be easily reset.
Instead of trying to reset everything back to your starting conditions, why not just rebuild the scene from scratch? It would be far easier.
Instead of trying to reset everything back to your starting conditions, why not just rebuild the scene from scratch? It would be far easier.
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: 176
- Joined: Fri Feb 27, 2009 7:12 am
- Location: Germany
- Contact:
Re: How to disable affection of a body's velocity in collision?
I think there are some scenarios where reseting a body is needed or would make thinks much easier. I would love to have a simple API call for that.
Visit our game Blog: [url]http://zombiesmash.gamedrs.com[/url] or follow us on twitter: [url]http://twitter.com/zombiesmash[/url]
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: How to disable affection of a body's velocity in collision?
Well, if you really want to reset a body you can remove it, it's shapes and joints from the space and call cpBodyInit() on it again. That would effectively flush out all of the cached collision and contact data from the space. At that point though it's pretty much the same as just creating a new body. The only thing you are saving is the pointer.
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/
Who is online
Users browsing this forum: No registered users and 11 guests