[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 - cpMouse Implementation Problems

cpMouse Implementation Problems

Official forum for the .

cpMouse Implementation Problems

Postby G-Ram » Sat Nov 14, 2009 9:41 pm

I implemented the cpMouse code into my project. There are no errors or warnings, but when I run the program it quits and the console reads "Assertion fail: (body != NULL), function cpShapeInit."
Here is my code:
extern void makeStaticBox(float x, float y, float width, float height);
cpSpace *space;
cpBody *staticBody
...
Sprite *Block1 = [[Sprite spriteWithFile:@"1x1.png"] retain];
Block1.position = cpv(160,240);
[self addChild: Block1];

cpVect verts[] = {
cpv(-36,-36),
cpv(-36, 36),
cpv(36, 36),
cpv(36,-36),
};

cpBody *Block1Body = cpBodyNew(50.0f, INFINITY);
Block1Body->p = cpv(160,240);
Block1Body->v = cpv(0, 0);

cpSpaceAddBody(space, Block1Body);

cpShape * Block1Shape = cpPolyShapeNew(Block1Body, 4, verts, cpvzero);
Block1Shape->e = 0.9f;
Block1Shape->u = 0.9f;
Block1Shape->data = Block1;
Block1Shape->collision_type = 0;
cpSpaceAddShape(space, Block1Shape);
CGSize s = [[Director sharedDirector] winSize];
int margin = 4;
int dmargin = margin*2;
makeStaticBox(margin, margin, s.width - dmargin, s.height - dmargin); //This references a static box the size of the window in a C class.
}
return self;
}
Please help!
G-Ram
 
Posts: 5
Joined: Thu Aug 13, 2009 9:14 pm

Re: cpMouse Implementation Problems

Postby Tam Toucan » Sun Nov 15, 2009 3:20 am

User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Re: cpMouse Implementation Problems

Postby G-Ram » Sun Nov 15, 2009 9:46 am

The cpBody *staticBox is referenced in the static box created in another class. Here is the code:
extern cpSpace* space;
extern cpBody *staticBody;

void makeStaticBox(float x, float y, float width, float height){
cpShape * shape;
shape = cpSegmentShapeNew(staticBody, cpv(x,y), cpv(x+width, y), 0.0f); //Specifically Here
shape->e = 1.0; shape->u = 1.0;
cpSpaceAddStaticShape(space, shape);

shape = cpSegmentShapeNew(staticBody, cpv(x+width, y), cpv(x+width, y+height ), 0.0f);
shape->e = 1.0; shape->u = 1.0;
cpSpaceAddStaticShape(space, shape);

shape = cpSegmentShapeNew(staticBody, cpv(x+width, y+height), cpv(x, y+height ), 0.0f);
shape->e = 1.0; shape->u = 1.0;
cpSpaceAddStaticShape(space, shape);

shape = cpSegmentShapeNew(staticBody, cpv(x, y+height ), cpv(x, y), 0.0f);
shape->e = 1.0; shape->u = 1.0;
cpSpaceAddStaticShape(space, shape);
}
Thanks! I am working on a stack trace.
G-Ram
 
Posts: 5
Joined: Thu Aug 13, 2009 9:14 pm

Re: cpMouse Implementation Problems

Postby Tam Toucan » Mon Nov 16, 2009 8:45 am

User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Re: cpMouse Implementation Problems

Postby G-Ram » Mon Nov 16, 2009 7:53 pm

Thanks so much!
G-Ram
 
Posts: 5
Joined: Thu Aug 13, 2009 9:14 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 3 guests