chipmunk

Accessing a property from a C method in Cocoa

I'm trying to learn Objective C & Cocoa, but I just can't manage to access a property inside an Object. Specifically an object from a C method. I'm working with the chipmunk dynamics library. Chipmunk has something similar to NSPoint called cpVect. Now I have no problem defining a cpVect inside my object, but when I try to make the acc...

What is Chipmunk? (Apart from being a Physics Engine)

Hopefully, this question isn't a dumb as I fear it sounds, but it may still be pretty dumb. I'm new to Objective-C, and Cocoa. In fact, I'm completely new to C in general. I'm trying to implement an iPhone game using Cocos2d-iPhone. It's a game I've made before in Flash, so I thought it would be a nice way to lean Objective C, cocoa an...

What's happening to the value of my member?

There's a joke in there somewhere. Anyhoot. In the following code, the setForceVector method has no actual effect on the value of member it's attempting to change. By checking the log, I can see the function is being called (by another object handling to a touchEvent). I've used NSLog to check that the forceVectorfromControls is actu...

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 should *1) be moving it by applying forces on the physics body behind it OR 2) if i ...

iphone cocos2d's chipmunk - Center of gravity

Hello wonderful people ! Here is my problem. I have a chipmunk's rigid body (a soda can standing up) that i want to change its center of gravity to the bottom of the object so it can fall on its flank when a force is applied to its upper part. Am I on the right track? 1) For some reason, I am having trouble setting the body's center ...

iphone cocos2d sprites disappearing

I've been working on a game and implementing the physics stuff with chipmunk. All was going fine on the cocos2d part until the integration with chipmunk. A bit of background: The game is a game with blocks. Levels are defined in a property list, where positions, size of the blocks, gravitational forces, etc., are all defined for each bl...

How can I detect a permanent collision with the Chipmunk Physics engine

I'm trying to play a "boing" sound when a ball shape hit's any other kind of shape. Which works. But works a little too well.... When the ball comes to rest, or starts to roll, it's in a permanent collision with whatever it's touching, so the "boing" sound fires constantly. I can't find anything in the chipmunk documentation to tell m...

How to detect stack objects falling down

Hi to All, 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 Bloxx" game. If any one knows it please help me out. ...

Problem using chipmunk

I made a game that using a character that can moving left or right by touching the screen, above the character, it is a apple, what i need is the apple will fall down, the character may push the apple up again just like playing volleyball. That's the problem,what i have learnt from "bounding ball" is give a sprite a shape and body, then ...

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 order to cut back on the amount of bodies in the chipmunk space. So with a map like this ...

how to Swing the stack object ?

Hi to all, I want to stack the objects like scoop game for iPhone & Tower Bloxx. I want to move that stack to left & right based on accelerometer. I am trying to do it by using chipmunk. I am able to stack but I cant able to swing that stack when it's moving from left to right or vice versa. If anyone knows it please help me out. Than...

c and objective-c variables

Hi all, 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 update "score" upon a collision between a bullet and a monster. Everything works...

Cocos2d and chipmunk how to simulate depth?

Hello, I am developing a game that intends to toss an object but instead of having it being tossed horizontally I would like to simulate it being thrown along the imaginary z axis that is simulate depth in my game. Something like the nintendo duck hunt game. Can someone point me in the right direction to implement this?. My first idea w...

Projectile Motion calculation with chipmunk dynamics.

I need to implement a little bit of Ai that can apply an impulse to a rigid body in order to hit a target. Like a cannon ball being fired from a cannon. I'm using Chipmunk Dynamics for the physics engine. My maths is terrible, as is my physics, but i've been reading up, and with a little help from SO and the following from this wikipedi...

Chipmunk collision detection

Hello, I am completely new to chipmunk and I have just been using it for a few days, so I'm guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback or method in chipmunk that tells you that 2 given shapes have collided?. If not is the best way to simply use cgrectcontains on th...

Chipmunk conditional collision on velocity?

Hello, I am doing a game with cocos2d and using chipmunk to manage the physics. What I would like to achieve is what pretty much every nintendo game does that your character may jump and rest in a higher floor (collision shape) without causing a collision as long as the velocity is positive, and that once the velocity is negative the co...

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 Chipmunk physics framework used in iPhone development. Basically I crash here because of s...

Cocos2d + Box2d or Chipmunk

OK, im trying to make an iphone version of a game i made here http://scratch.mit.edu/projects/techy/781198 is box2d or chipmunk better and where are some tutorials for each one ...

Getting X window id for GLUT program? or, How to remote control a GLUT program on X?

I want to send a keystroke to a GLUT program on X11, but I can't find there's an X11 client attached to the GLUT program. I do this, using the most excellent demo program for the chipmunk 2d physics package: xlsclients -a|sort >aa chipmunk_demos (in another window) xlsclients -a|sort >bb diff aa bb and there's no difference. My eve...

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 permanently off the screen */ /* so it needs to be permanently deleted */ cpBodyFree(bod...