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

map image on object

Topics: Developer Forum, User Forum
Apr 4, 2008 at 1:30 AM
Sorry if this is a repeat question. I can't seem to find it in the search.
Can we map images, like jpeg, onto objects in Farseer?

Thank you!
Apr 4, 2008 at 3:40 AM
No, not as simple as you suggest. But it's not complicated at all.

What you have to do is to create a Body and Geometry object that will have the shape of your texture. Rectangles and circles are extremely simple to create, just take a look at the samples. If you need complex shapes, then you have to use polygons but I never had to so I can't really help you there.
Apr 4, 2008 at 5:16 AM
maybe i'm a rookie at this (ha, i said rookie, not newbie... someone kick me off the internet!), and maybe you've already thought of this, but you are aware you can import 3d objects you create in a 3d program, that have images mapped to their surfaces, right? if the trouble simply is you don't know how to do this, i could make you a video of how to do it in 3d studio max.
Apr 4, 2008 at 2:26 PM
I think the question is more related to 2D drawing.

Generate a list of points within your image that identify the edges.
Turn each of these into a Vector2D and add it to a Vertices instance.
Create a polygon Body and Geom from the Vertices.

I considered writing a small app to generate code similar to what jhkings suggested, but never got around to it. Maybe if there's a need, I will.
Apr 9, 2008 at 12:41 AM
Thanks everyone!
I understand the texture mapping is a bit complex in a 3D objects. Just wondering if it's already in Farseer. But since Farseer has reduced the complexity to two axis, I think image rotation might not be so bad. I think if there's texture mapping in Farseer, it will be very useful in a lot of places.

Apr 10, 2008 at 5:26 PM
Farseer is a physics engine, it knows nothing about textures.