This project has moved and is read-only. For the latest updates, please go here.

Problem with mapping a texture to a body

Topics: Developer Forum, User Forum
Jul 1, 2012 at 6:59 PM

Hello, another day another problem.

I managed to get my nice multi-fixture circle body algorithm right and to produce the right results. I now have a fully functional system to delete fixtures from the contraption.

Now the only remaining problem is: mapping a texture to the beast.

Here is a picture of the physics body where I need to map a texture (it's round, even tho you can't see it in the picture). The problem I have is that the texture needs to be clipped after the fixtures are removed. 

My question is: is there a way to accomplish this?

EDIT: I've tinkered around with the code of texture splitting and cutting that I found around here, but I couldn't get it to work with what I am working with here. Perhaps someone else can?

Jul 2, 2012 at 2:26 PM

Alright with a bit more tinkering, I managed to achieve these 2 scenarios:

This is the texture cutting testbed thing that I talked about earlier, but with the body made with my algorithm and mapped with my texture. I also tested deleting fixtures from the contraption, everything works fine.

I then went and copied the code over to my own project. Everything is exactly the same, except my Projection and View used for the BasicEffect are changed according to my camera.

The result:

If anyone had any clue what went wrong, I would highly appreciate it

Jul 2, 2012 at 10:55 PM

And it's solved. 

The problem was the min and max vectors in the end of the constructor of the TexturedFixture.