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;…
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…
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…
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!
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…
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…
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…
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…
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…
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…
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??
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…
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…
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…
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…