[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Assertion failed error after moving to chipmunk 5

Assertion failed error after moving to chipmunk 5

Official forum for the .

Assertion failed error after moving to chipmunk 5

Postby Bongeh » Wed Feb 03, 2010 7:30 am

Hi there,

I've been using chipmunk in conjunction with cocos2d for about a month now, and i decided to upgrade to v5 because of the begin and seperate collision handlers etc, from what ive used and seen, its a huge improvement! :D

i rewrote my collisionhandlers and ran my program with 1 enemy sprite, everything worked fine, collisions did as they were sposed too..

as soon as i add any more sprites into my game i get this error

Assertion failed: (value), function k_scalar, file /User/Documents/Games/platforms/libs/Chipmunk/src/include/chipmunk/constraints/util.h, line 72.

I'm not entirely sure where im going wrong, but i believe its being caused as i add more objects to the "gameSpace"?

I'll be happy to post code if you need to see it.

My enemy sprites are a subclass of CCSprite (cocos) which have an init function that sets up there cpShape/body thing.

The error happens regardless of wether i add the objects as children to my scene, so im guessing it must be happening as they are added into chipmunks space.
Last edited by Bongeh on Thu Feb 11, 2010 5:11 pm, edited 1 time in total.
User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby Bongeh » Wed Feb 03, 2010 7:43 am

User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby Bongeh » Wed Feb 03, 2010 9:38 am

Last edited by Bongeh on Thu Feb 11, 2010 5:12 pm, edited 1 time in total.
User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby slembcke » Wed Feb 03, 2010 9:46 am

Yeah, I went back and redid all the assertions to print out more descriptive errors a day or two ago.

You are probably allowing two objects of infinite mass to collide. Try inspecting the two bodies in the k_scalar function using the debugger when it crashes.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Assertion failed error after moving to chipmunk 5

Postby Bongeh » Wed Feb 03, 2010 9:51 am

thank you for your reply, if i have not set a collision handler for objects of the same collision type to touch each other, does it not just ignore them?
User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby Bongeh » Wed Feb 03, 2010 9:59 am

all of my objects have infinity mass.

my player, my enemies, they did in chipmunk 4.. im not using chipmunk to simulate the reactions of the collisions, just to detect them.

i thought this was the correct way to do it if i didnt want chipmunk to use forces on them.
User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby Bongeh » Wed Feb 03, 2010 10:10 am

sorry for the triple post!

You were entirely correct! :D

it was that two of my enemies spawned on the same spot.

I wish for some of my enemies to be able to pass through each other, and for me not to have this crash. What do i need to do in order to stop this from happening? give them a set mass instead of INFINITY?
User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby slembcke » Wed Feb 03, 2010 1:00 pm

So you are using Chipmunks collision detection by setting the positions of the sprites at every frame? That assertion happens from within the impulse solver, and if allowed to continue would result in the velocity of the objects getting set to NaN. This would have happened in Chipmunk 4 as well, just without the assertion. So I assume you must be overwriting the positions or something.

If you don't need the collision response that Chipmunk calculates, you should set the space's iterations and elastic iterations to 0 to disable it. The impulse solver tends to be the most expensive part of Chipmunk anyway.

Lastly, to disable the assertions altogether, you need to compile with -DNDEBUG. Add it to the "other C flags" property in the XCode target's build settings. You should be doing this at least for release as some of the assertions can be expensive.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Assertion failed error after moving to chipmunk 5

Postby Bongeh » Fri Feb 05, 2010 3:44 am

thank you very much slembcke, yes, for this project i am just using chipmunk as an easy way to detect accurate collisions on non ordinary shapes, an L shape etc...

I have a scheduler that cycles through my sprites and updates there positions manually yes.

Thanks again
User avatar
Bongeh
 
Posts: 11
Joined: Wed Feb 03, 2010 7:25 am

Re: Assertion failed error after moving to chipmunk 5

Postby slembcke » Fri Feb 05, 2010 9:30 am

The issue that the assertion is trying to prevent is bodies basically disappearing when an unsolvable collision happens. It would have been happening to you before had you not overwritten the positions of the objects every time before drawing them. So you just never knew it.

What you should be doing is returning false from all of your collision handler preSolve() callbacks. That way the collisions will never be added to the solver. Then disable the solver entirely by setting iterations and elastic iterations to 0. This way you've disabled queuing the collisions to the solver system as well as attempting to solve them. This make the game run measurably faster. Make sure to disable the assertions when compiling for release/distribution as well.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Next

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest