[Noob][Ruby] Discrepency between shape and drawing

Official forum for the Chipmunk2D Physics Library.
Post Reply
gdurelle
Posts: 3
Joined: Sun Dec 04, 2011 12:57 pm
Location: France
Contact:

[Noob][Ruby] Discrepency between shape and drawing

Post by gdurelle »

Hello,

I'm discovering Chipmunk under Ruby, using it with Gosu.

And have a little problem in here : http://github.com/gdurelle/RPong where I try to create a very simple pong game to learn Chipmunk.

The Paddles drawn are not actually the shape they got, meaning the ball bouce on it but on the extremities it has a strange behaviour.
Above the top of it, it bounces when should continue.
In its bottom part, it go through it when it should bounce.

I described the problem here : http://github.com/gdurelle/RPong/issues/1

Any idea ?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: [Noob][Ruby] Discrepency between shape and drawing

Post by slembcke »

Are you making the paddle as a static shape by chance? If you move a static shape, the collision detection data won't be automatically updated unless you call one of the cpSpaceReindex shape functions.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
gdurelle
Posts: 3
Joined: Sun Dec 04, 2011 12:57 pm
Location: France
Contact:

Re: [Noob][Ruby] Discrepency between shape and drawing

Post by gdurelle »

Not sure to known what it means in fact...
I tried to add

Code: Select all

@space.rehash_static()
in my update method, but it did not change anything...

My Paddle is moving when I press arrow keys.
I add it to the space through :

Code: Select all

@space.add_body(left_body)
@space.add_shape(left_shape)
I currently not fully understand the differences between Shape and Body so, and the good Vector use with them, so please be patient ;)

I documented myself with existing code for the gosu tutorial move to chipmunk and this : http://beoran.github.com/chipmunk/#BB rdoc.

I must have missed some things...
gdurelle
Posts: 3
Joined: Sun Dec 04, 2011 12:57 pm
Location: France
Contact:

Re: [Noob][Ruby] Discrepency between shape and drawing

Post by gdurelle »

anyone ?
Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests