Ah Collisions.. why not eh?

Official forum for the Chipmunk2D Physics Library.
jaysonturner
Posts: 13
Joined: Wed Jul 22, 2009 12:17 pm
Contact:

Ah Collisions.. why not eh?

Post 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.)

Code: Select all

         1.0
         |
-1.5----------1.5
         |
         -1.0
..everything was working fine.

I've altered the values and those of objects drawn to use this system now.

Code: Select all

          16.0
          |
-24.0--------24.0
          |
          -16.0
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?
jaysonturner
Posts: 13
Joined: Wed Jul 22, 2009 12:17 pm
Contact:

Re: Ah Collisions.. why not eh?

Post by jaysonturner »

ignore this, im a total sp.... erm can't think of the politically correct term..
jaysonturner
Posts: 13
Joined: Wed Jul 22, 2009 12:17 pm
Contact:

Re: Ah Collisions.. why not eh?

Post 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 :)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Ah Collisions.. why not eh?

Post 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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
jaysonturner
Posts: 13
Joined: Wed Jul 22, 2009 12:17 pm
Contact:

Re: Ah Collisions.. why not eh?

Post by jaysonturner »

ill start from scratch and see what happens... watch this post.
jaysonturner
Posts: 13
Joined: Wed Jul 22, 2009 12:17 pm
Contact:

Re: Ah Collisions.. why not eh?

Post 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.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Ah Collisions.. why not eh?

Post by slembcke »

Doubtful. The only thing that changes is which direction they move in.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
jaysonturner
Posts: 13
Joined: Wed Jul 22, 2009 12:17 pm
Contact:

Re: Ah Collisions.. why not eh?

Post 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?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Ah Collisions.. why not eh?

Post 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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
Tam Toucan
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm
Contact:

Re: Ah Collisions.. why not eh?

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests