Coliision Point

Previous topic - Next topic

matchy

AMateus, I'm not sure what you mean because I use no 2D sprites nor any form of trickery, just texture sprite mapping in 3D.

erico

great prototype you have there!

AMateus

Quote from: matchy on 2011-Oct-06
AMateus, I'm not sure what you mean because I use no 2D sprites nor any form of trickery, just texture sprite mapping in 3D.

To my knowledge, the Box2D wrapper doesn't have collision listeners implemented, so in GLB I'm unable to detect Box2D collisions. Normally the workaround is to have a sprite bigger than the physics body and detect the sprite collision before the physics collision and act accordingly.

If you don't use this trick, how do you know that a collision in Box2D has occurred to play the sound?

António

Ian Price

Matchy gets his balls out, videos them and everyone want to have a play with them! What has this forum come to?

Looks cool =D
I came. I saw. I played.

matchy

#19
Just dusting off that one year old video. :P

Quote from: AMateus on 2011-Oct-06
If you don't use this trick, how do you know that a collision in Box2D has occurred to play the sound?

Although I do agree that internal Box2D collisions are needed (and I have attempted to understand it), there are ways around it for now.

I think I'm mentioned twice that I use distance collision (from the center point of the white ball to nearby balls' center point). Obviously if an object is equal or less than the radius, then reverse the vectors and play a sound. Note that a simple calculation/bit shift can cater for this saving on calc/call cycles.

The other method is to check the vector, x and y velocity. Check for a reserve change, which could mean a rebound.

For a better commercial demo of Box2D with sound, check out djtoon's technique!
http://www.glbasic.com/forum/index.php?topic=7037.0

AMateus

Quote from: matchy on 2011-Oct-06Again, please don't refer to it a trickery as the proper and respectable term is technique, especially if you have no code to show for.

English is not my main language and it appears I have mistaken the meaning of the word "trick" (probably used in the wrong context or something). I didn't meant to sound disrespectful. But point taken. My apologies.

Thank you for your help. I will give it a try

Regards,
António

Kitty Hello

I updated the Box2D example here in the forums to get collision feedbacks.

I forgot the point of collision. Is that of any value?

AMateus

Thank you so much =)

It was exactly this I was looking for. I think the point of collision could be of some value yes. If there is a intention of for example, deforming the sprite based on the impact point ;)

But at least for me, now, I'm pretty happy.

Thank you again =)
António