开发者

Chipmunk shapes not colliding

开发者 https://www.devze.com 2023-02-05 14:57 出处:网络
I am able to create spaces, bodies, and shapes, put them together, and draw them on screen... yet somehow none of my shapes are interacting with each other or colliding. My collision callback isn\'t g

I am able to create spaces, bodies, and shapes, put them together, and draw them on screen... yet somehow none of my shapes are interacting with each other or colliding. My collision callback isn't getting called either. What could be causing this?

I create a space:

cpSpace *space = cpSpaceNew();
cpSpaceSetDefaultCollisionHandler(space,handleCollision,NULL,NULL, NULL,self);

I create bodies:

body = cpBodyNew(mass, moment);

I create shapes for the bodies:

cpCircleShapeNew(body, radius, offset);

I add the body to the space:

cpSpaceAddShape(space, shape);

I step through time, (and draw开发者_高级运维, obviously):

cpSpaceStep(space, dt);

And yet my shapes and bodies refuse to interact with eachother.


lol! forgot to call cpInitChipmunk()

0

精彩评论

暂无评论...
验证码 换一张
取 消