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

Add texture to body

Topics: Developer Forum, Project Management Forum, User Forum
Feb 16, 2012 at 10:31 AM

Hi All,

Im developing a silverlight physics game, but a how do i add texture to body, i mean. if i create body from body factory, for egzample a circle, how i display wheel texture on it, and how do disable debug view ? I can't find answer for two days... :( Thx for any help;) sorry for my bad english

Feb 16, 2012 at 3:00 PM

Your most likely going to want to set a bool to turn your debug view on and off. for drawing a texture to a body in your draw code you could do something like the following

 batch.Draw(_body.Texture, ConvertUnits.ToDisplayUnits(_body.Position), null, Color.White, _body.Rotation, _body.Origin, 1f, SpriteEffects.None, 0f);

Hope this helps.

Feb 22, 2012 at 10:19 AM

Thx a lot, i done it with simmilar way, but i don;t have ConvertUnits.ToDisplayUnits in silverlight, I just gueess how much pixel is for one meter ( i do this experimatally) . So Where is ConvertUnits class ? it will be much easier;)