Sprite Animation in Farseer

Jul 26, 2010 at 9:07 AM
Is it possible to declare Body and Geometry on a sprite animation texture? Or is there any where I can declare physics object/attributes for a sprite animation texture? Thank You.
Jul 26, 2010 at 3:33 PM
I saw your post at the FRB forum as well, so I guess you mean with sprite animation the FRB animation class. You must understand how a physics engine works; it's like a black box in which you create bodies / geoms (called fixtures in F3) and which you update. During an update the black box moves and rotates the bodies you created. So, that's it. It has nothing to do with sprites or animations. If you want an object in your game to have both a sprite / animation and both a physics body, make a new class and let it have a reference to the sprite and to the physics body. Make sure you update that class, where you update the sprite / animation coordinates to the coordinates of the physics body.
Jul 26, 2010 at 3:36 PM
Alright, thanks alot for the reply, I'll try to work on it :D


Regards,
Cadrick



On 26-Jul-2010, at 11:33 PM, jordos wrote:

From: jordos

I saw your post at the FRB forum as well, so I guess you mean with sprite animation the FRB animation class. You must understand how a physics engine works; it's like a black box in which you create bodies / geoms (called fixtures in F3) and which you update. During an update the black box moves and rotates the bodies you created. So, that's it. It has nothing to do with sprites or animations. If you want an object in your game to have both a sprite / animation and both a physics body, make a new class and let it have a reference to the sprite and to the physics body. Make sure you update that class, where you update the sprite / animation coordinates to the coordinates of the physics body.

Read the full discussion online.

To add a post to this discussion, reply to this email (FarseerPhysics@discussions.codeplex.com)

To start a new discussion for this project, email FarseerPhysics@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Jul 26, 2010 at 6:50 PM

Did you mean to ask how to generate physics geometry from a texture - where the texture comes from individual frames of a FRB animation instance?

Jul 27, 2010 at 1:04 AM
JeroMiya: yea... that's what i mean...
Jul 27, 2010 at 9:39 PM
I'm not familiar with FRB's animation sheets, but if you can get a Texture2D containing just the specific frame you are looking for (if the frames are all contained on a single Texture2D, you can draw the sprite frame to a new Texture2D and use that). Once you have the frame's Texture2D, take a look at TextureVerticesTest.cs in the TestBed project. This shows you how to convert a Texture2D into the geometry. There are multiple steps involved.