Just wondered if there was an easy way of taking a body with multiple fixtures and translating this during rendering into multiple sprites. For instead I had two rectangles added as separate fixtures and I wanted to render them with two separate shapes. How do i retrieve the individual fixture locations in order to render them correctly for a frame.
Thanks
Comments
If for example at some point you want to break body into pieces, where each fixture is a new piece, then you could use a sprite to group multiple images as one, and attach it to the body, like you'd do with normal image.
I want to be able to control of the fixtures so that i could add,remove and update them when needed. I also wanted the body to follow the exact shapes of the children.
The specific problem that prompted me down this root is: i wanted to have a group of sprites, that I had anchored using a weld joint with fixed rotation. This seemed to be impossible to configure in box2d. Fixed rotation on the sprites put strain on the joints and pulled them a part. with the sprites welded together it was impossible to prevent them from rotating. I tried overriding the rotation value during 'enter frame' but this produced an interesting but undesired effect. So I came to the conclusion that the only correct way would be through fixtures, this way i should be able to fix the rotation of the body as a whole.
Don't know if you've seen this example:
http://appcodingeasy.com/Gideros-Mobile/Gideros--Creating-and-breaking-complex-shape
i was searching for way to get all fixtures that attached to body. in box2d, it's GetFixturesList. But it seems it is currently not implemented yet
But for now I've always saved fixtures as properties of box2d body and then get them whenever I need to
example:
poly:setAsBox(bodyWidth*0.5,5,0,bodyHeight,0)
body.fixtureFootSensor = body:createFixture{
shape = poly,
density = 0.000001,
friction = 0,
restitution = 0,
isSensor = true
}
body.fixtureFootSensor.Name = "FootSensor"
--[[
so how i know a fixtures is in colission ?
example: footSensor is colission with ground, foot sensor is multi fixtures with my body, i saw in box2d forums them used set user data and get user data
but what i can do in gideros ?
p/s: sorry im bad english
]]