views:

112

answers:

3

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.

+3  A: 

You need to calculate the forces and torques on each object.

Gravity acts on the center of mass of an object. If this object overhangs another object, then there could be a torque that could roll the object off.

If you've got the physics down so that it's realistic, then you can detect whether the stack is stable or not by monitoring the direction of the velocity for each object. If it's changing sign, and the magnitude is getting smaller, then it's stabilizing. (If it's zero, it is stable already.)

John at CashCommons
†hanks John for your valuable answer. I will try it and will let you know
Jyotsna
+1  A: 

This question is better suited to iphonegamedev.stackexchange.com, try asking there.

Kendall Helmstetter Gelner
He'll get a better answer here, and besides; this *is* programming related
RCIX
A: 

I'm not familiar with the structure of the chipmunk engine, but does it have some sort of collision event? If so, you could use that event to detect when any block but the base one hits the ground object and end the game then.

RCIX