Questions tagged [chipmunk]

Chipmunk is an open-source physics library written in C.

See: The Chipmunk Website

318 questions
2
votes
0 answers

Cocos2D v3 Calculate the distance after collision

Is it possible to calculate distance at which the body will fly off in method -(BOOL)ccPhysicsCollisionBegin:typeA:typeB I need the exact point, where the body would end up after collision. In other words, will it fly off towards boundary or not;…
Vitalii Vashchenko
  • 1,777
  • 1
  • 13
  • 23
2
votes
3 answers

Chipmunk: how to delete a body?

What's the right way to delete a Chipmunk body? Simply calling cpBodyFree or cpBodyDestroy doesn't seem to work, as the body still shows up in the cpSpaceEachBody iteration. if(body->p.y < -260 || fabsf(body->p.x) > 340) { /* body is…
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
2
votes
3 answers

Cocos2d v3 & chipmunk collision detection issues

First try at Chipmunk. Not getting collision detection registering is the problem. My code: @implementation MainPlayScene { CCPhysicsNode *_physics; CCNode *MyPhysicsBody; CCNode *bottomBody; } + (instancetype)scene { return [[self…
J C
  • 63
  • 1
  • 7
2
votes
2 answers

MouseJoint in cocos2d V3 for iOS

I'm looking for "MouseJoints" or an equivalent in the new version of cocos2d (3.0) for iOS which use the Chipmunk physics library instead of Box2d. Is there anything like this? Thanks in advance!
2
votes
0 answers

Cocos2D 3.0 ObjectiveChipmunk/ObjectiveChipmunk.h file not found?

I am trying to integrate Cocos2D 3.0 into my project and the last error I face is: 'ObjectiveChipmunk/ObjectiveChipmunk.h' file not found - CCPhysics+ObjectiveChipmunk.h Now CCPhysics+ObjectiveChipmunk.h is definitely in my project. I have included…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
2
votes
2 answers

How to log data & type from a void pointer?

I have the following code: eachShape(void *ptr, void* unused) { cpShape *shape = (cpShape *) ptr; id obj = shape->data; NSLog(@"shape->data: %@", obj); // this is where EXC_BAD_ACCESS can occur ... Some of you may recognize it from the…
Greg
  • 1,126
  • 2
  • 11
  • 26
2
votes
1 answer

Dampening a collision in pymunk

Is there a way to dampen a collision in pymunk. I'm trying to simulate space ships and when they collide they shouldn't just bounce apart. Gravity is (0,0). I want to absorb about 90% of an impact basically as if the hull was crumpling under the…
Kaliber64
  • 586
  • 1
  • 5
  • 16
2
votes
4 answers

c and objective-c variables

Let me see if I can articulate what I'm trying to do... I'll distill it to the core issue. I have an objective-c program and a c callback function. The context is I am using cocos2d and chipmunk physics with the iphone sdk. What I am trying to do is…
Ferris
  • 111
  • 1
  • 4
2
votes
1 answer

How to implement moving platforms with Cocos2d, TMXTiledMaps and Chipmunk

I'm making slow but steady progress with a Cocos2d game, but I'm stuck creating moving platforms. The main character needs physics and collision detection, and is therefore a chipmunk shape/body. I wrote a class to iterate over the TMXTiledMap in…
gargantuan
  • 8,888
  • 16
  • 67
  • 108
2
votes
2 answers

How to detect stack objects falling down

In my game, Objects are falling down and I have to catch that object and have to create a stack. I am doing this by using chipmunk physics engine. I am able to create stack but I don't understand how to detect that stack is falling like "Tower…
Jyotsna
  • 4,021
  • 4
  • 22
  • 25
2
votes
1 answer

Why is pymunk terminating?

This simple pymunk code is giving me problems: space = pm.Space() b = pm.Body() b.position = 400,400 c = pm.Circle(b,10) space.add(b,c) The above code creates a dialog like the one below Why is this happening, and how do I solve this??
pradyunsg
  • 18,287
  • 11
  • 43
  • 96
2
votes
0 answers

chipmunk vs box2d

I am working on a platformer for iOS and was looking for the best way to incorporate the physics. The physics need only be very basic. But most of all for detection of the collision between the enemies and player, and realistic running (speeding up…
user2281530
  • 21
  • 1
  • 2
2
votes
1 answer

Pymunk -- Finding a body's associated shapes and constraints

I'm trying to find some way to iterate over the constraints dependent on a specific body in pymunk. There seem to be multiple ways to do so in Chipmunk, but I can't find an equivalent in pymunk. I would like to see some way to detect constraints…
desophos
  • 207
  • 1
  • 9
2
votes
2 answers

Creating DampedRotarySpring in pymunk between a dynamic body and a moving static body

I'm trying to do what the title says. I have a character with a gun constrained to its hand, and I'm trying to get the gun to point at the cursor. I figured that a DampedRotarySpring would be a nice way to do it, but it turns out not to be as simple…
desophos
  • 207
  • 1
  • 9
2
votes
2 answers

cocos2d iphone - game architecture: physics VS. code simulated sprite behaviors

Hello stackoverflow community ! I am trying to figure out how to architect my game using cocos2d. My problem is that cocos2d's physics engine (i'm talking about chipmunk) lies in a world behind sprites. When I move the sprite, I'm wondering if I…
Yohann T.
  • 1,915
  • 2
  • 23
  • 28