Hi,
In box2d the Debug Draw is highlighting objects that are colliding.
How can I get that information in the code? (test if object A collides with object
I want to apply a modification on an object, based on the other object it collides with.
Edit: Also, I need to access the sprite which the body is attached to.
Greetings
Comments
To access the sprite, you can actually set a back-reference to it in the body.
- get fixture
- get body from fixture
- get parent from body, which we did set above
But it my case it was. Now if someone wants to know why, here's an awful video :'D
The guy's body is a ball, and the sprite is not synced with the ball's rotation (obviously). But the guy's sprite orientation should be synced with the surface's rotation.
Just for fun, what happens IF the guy's rotation is synced with his body
It takes a little getting used to, because you get collisions for all fixtures at the same time. It takes a little filtering to use them.
Likes: Holonist, antix