Body disappearing upon collision

Discuss any Chipmunk bugs here.

Re: Body disappearing upon collision

Postby Michael Buckley » Mon Sep 24, 2007 12:29 am

slembcke wrote:Could you explain what you mean by using ints? Do you mean simply changing a 0 to a 0.0f or something? What compiler?


Well, while that specific example might work, what I was running up against was that I was reading shape coordinates, stored as ints, from a file, and then passing them as parameters to different chipmunk functions. I don't specifically remember what I was doing though, but when my character would collide with the ground (the only two things I had on the field at the time) the character's x and y variables would get set to NaN.
Michael Buckley
 
Posts: 46
Joined: Tue Aug 21, 2007 10:30 am

Re: Body disappearing upon collision

Postby slembcke » Mon Sep 24, 2007 8:16 am

That is... very strange. No idea why an implicit cast would be any different.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Body disappearing upon collision

Postby Michael Buckley » Tue Sep 25, 2007 12:15 pm

From what I gathered, no implicit casting was happening. (I built a version of chipmunk that printed out the hex values of the different variables when the shape was created.) I was not explicitly casting, and the ints I passed on were being treated as floats. That is, no changes were made to their bits. With 0, this doesn't make a difference, since the bits are all the same, but generally, I found that the bits I were passing in were invalid as floats.

This may be due to the fact that I was using Uint32, Sint32, etc. instead of unsigned int, int, etc. but I'm pretty sure I had some hard-coded values (e.g. cpv(10, 100);) which failed too.
Michael Buckley
 
Posts: 46
Joined: Tue Aug 21, 2007 10:30 am

Re: Body disappearing upon collision

Postby slembcke » Tue Sep 25, 2007 11:28 pm

Very odd. I had never heard of such a problem before. I've been trying to be a stickler for making actual float constants. Maybe that's why I've not run into it.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Previous

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron