I have a sprite which has two child sprites attached to it.
I've added all 3 to the box2d collision system.
As far as collisions go, the parent level sprite is detected and collided against.
The other two are ignored. I believe this is because when I added the 2 children
sprites, they had local coordinates (in relation to their parents).
To fix this, I calculated the world coordinates of the 2 child sprites (local + parent x/y)
and passed the info to the box2d coll system that way.
After this, the collisions started working, but my objects were no longer being displayed
properly. I think adding the children sprites as user data to the coll system affects their
sprite x/y. (for this case i'm only dealing with static objects)
Is there someway to pass in local coordinates for children sprites and set some flag that
tells the box2d system to aggregate their x/y positions to get a world one for collision detections?
Or am I approaching this in the wrong way?
Thanks,
Joe
I've added all 3 to the box2d collision system.
As far as collisions go, the parent level sprite is detected and collided against.
The other two are ignored. I believe this is because when I added the 2 children
sprites, they had local coordinates (in relation to their parents).
To fix this, I calculated the world coordinates of the 2 child sprites (local + parent x/y)
and passed the info to the box2d coll system that way.
After this, the collisions started working, but my objects were no longer being displayed
properly. I think adding the children sprites as user data to the coll system affects their
sprite x/y. (for this case i'm only dealing with static objects)
Is there someway to pass in local coordinates for children sprites and set some flag that
tells the box2d system to aggregate their x/y positions to get a world one for collision detections?
Or am I approaching this in the wrong way?
Thanks,
Joe