Page 1 of 2
Ah Collisions.. why not eh?
Posted: Fri Aug 28, 2009 12:45 pm
by jaysonturner
Hello,
I've messing about with CP and OpenGLES. Started out with using co-ordinates in this form.. (Try an ignore how rubbish these diagrams are. The origin is in the centre of the screen.)
..everything was working fine.
I've altered the values and those of objects drawn to use this system now.
And for some reason collisions no longer work. I've tried altering the step rate but this seems to have very little effect. Things occasionally collide but not consistently.
Any ideas?
Re: Ah Collisions.. why not eh?
Posted: Fri Aug 28, 2009 12:58 pm
by jaysonturner
ignore this, im a total sp.... erm can't think of the politically correct term..
Re: Ah Collisions.. why not eh?
Posted: Fri Aug 28, 2009 1:07 pm
by jaysonturner
argh thought id solved it, made my line segments thicker, but still when my active body picks up acceleration it still flyies through the segements...
tips on how to solve this possibly common issue?
a point the right direction will do

Re: Ah Collisions.. why not eh?
Posted: Fri Aug 28, 2009 2:55 pm
by slembcke
All you changed was the scale and now all your objects don't work? Are you sure you scaled everything? The positions of the bodies and the sizes of the shapes that you are creating? Otherwise I have no idea what the problem could be.
Re: Ah Collisions.. why not eh?
Posted: Sat Aug 29, 2009 8:08 am
by jaysonturner
ill start from scratch and see what happens... watch this post.
Re: Ah Collisions.. why not eh?
Posted: Mon Aug 31, 2009 2:56 pm
by jaysonturner
could the problem be that the position of gravity changes in every iteration of the game loop? the gravity of the space is set to different co-ordinates depending on the rotation of the iphone.
Re: Ah Collisions.. why not eh?
Posted: Mon Aug 31, 2009 3:46 pm
by slembcke
Doubtful. The only thing that changes is which direction they move in.
Re: Ah Collisions.. why not eh?
Posted: Tue Sep 01, 2009 10:50 am
by jaysonturner
Well, after a bit of re-factoring, collisions are working better. They are however still inconsistent.
Basically if i whiz my iphone around with a little bit of rapidity, the active object is able to break through the 4 segments shielding the sides of the screen...
any more thoughts?
Re: Ah Collisions.. why not eh?
Posted: Tue Sep 01, 2009 11:17 am
by slembcke
Chipmunk does not perform swept collisions. If objects are moving fast enough they will be able to pass through each other. You either need to make the objects larger, or slow them down.
Re: Ah Collisions.. why not eh?
Posted: Tue Sep 01, 2009 12:01 pm
by Tam Toucan
Adding to that, so either make the line segments thicker (see cpSegmentShapeNew), or (at the cost of more CPU for the collisions) change the 4 segments into polygons to make thick walls.