<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>FarseerPhysics Forum Rss Feed</title><link>http://www.codeplex.com/Project/ListForums.aspx?ProjectName=FarseerPhysics</link><description>FarseerPhysics Forum Rss Description</description><item><title>New Post: How can I use the ContactListener?</title><link>http://farseerphysics.codeplex.com/discussions/444259</link><description>&lt;div style="line-height: normal;"&gt;Here's how I do it:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;    // do this on whatever constructor / init function you have
    void Start()
    {
        // get the world singleton somehow
        World world = FSWorldComponent.PhysicsWorld;

        // register
        world.ContactManager.BeginContact += onBeginContact;
        world.ContactManager.EndContact += onEndContact;
        world.ContactManager.PreSolve += onPreSolve;
        world.ContactManager.PostSolve += onPostSolve;

        // NOTE: you should probably unregister on destructor or wherever is relevant...
    }

    bool onBeginContact( Contact _contact )
    {
        // ...
        return true; // or false to ignore the contact
    }
    void onEndContact( Contact _contact )
    {
        // ...
    }

    void onPreSolve( Contact _contact, ref Manifold _oldManifold )
    {
        // ...
    }
    void onPostSolve( Contact _contact, ContactVelocityConstraint _impulse )
    {
        // ...
    }&lt;/code&gt;&lt;/pre&gt;

I use the Unity port of Farseer so your mileage may vary.&lt;br /&gt;
&lt;/div&gt;</description><author>benblo</author><pubDate>Tue, 21 May 2013 08:49:31 GMT</pubDate><guid isPermaLink="false">New Post: How can I use the ContactListener? 20130521084931A</guid></item><item><title>New Post: Games That Use Farseer Physics Engine 3.x</title><link>http://farseerphysics.codeplex.com/discussions/224442</link><description>&lt;div style="line-height: normal;"&gt;Pinball league: The World of Dr. Pickaxe&lt;br /&gt;
&lt;br /&gt;
Pinball game for Windows Phone &amp;amp; Windows Store. &lt;br /&gt;
Developed on XNA/monoGame.&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://tainicom.net/ImageGen.ashx?image=/media/4286/12-stonehenge.jpg&amp;amp;width=240" alt="Image" /&gt;&lt;br /&gt;
&lt;br /&gt;
Dr Pickaxe for Windows Phone: &lt;br /&gt;
&lt;a href="http://tainicom.net/games/pinball-league-the-world-of-dr-pickaxe.aspx" rel="nofollow"&gt;http://tainicom.net/games/pinball-league-the-world-of-dr-pickaxe.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Dr Pickaxe for Windows 8/RT: &lt;br /&gt;
&lt;a href="http://tainicom.net/games/pinball-league-the-world-of-dr-pickaxe-hd.aspx" rel="nofollow"&gt;http://tainicom.net/games/pinball-league-the-world-of-dr-pickaxe-hd.aspx&lt;/a&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>nkast</author><pubDate>Tue, 21 May 2013 07:54:53 GMT</pubDate><guid isPermaLink="false">New Post: Games That Use Farseer Physics Engine 3.x 20130521075453A</guid></item><item><title>New Post: How can I create polygons in Farseer 3.3.1?</title><link>http://farseerphysics.codeplex.com/discussions/444315</link><description>&lt;div style="line-height: normal;"&gt;Look at the specs! Its (data, width, holeDetection), so change it to&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;Vertices  verts = PolygonTools.CreatePolygon(data, polygonTexture.Width, true);&lt;/code&gt;&lt;/pre&gt;

But I highly recommend to look at the farseer samples project. There, AdvancedDemo1 greatly explains how to make an physical object out of a texture. &lt;br /&gt;
&lt;/div&gt;</description><author>streikbrecher</author><pubDate>Tue, 21 May 2013 07:47:18 GMT</pubDate><guid isPermaLink="false">New Post: How can I create polygons in Farseer 3.3.1? 20130521074718A</guid></item><item><title>New Post: How can I create polygons in Farseer 3.3.1?</title><link>http://farseerphysics.codeplex.com/discussions/444315</link><description>&lt;div style="line-height: normal;"&gt;Thanx. But I still have difficulties with this line:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; //Find the vertices that makes up the outline of the shape in the texture
          Vertices  verts = PolygonTools.CreatePolygon(data, polygonTexture.Width, polygonTexture.Height, true);&lt;/code&gt;&lt;/pre&gt;

No overload for method 'CreatePolygon' takes 4 arguments	&lt;br /&gt;
&lt;br /&gt;
What should I change in this line?&lt;br /&gt;
&lt;/div&gt;</description><author>Wizard999</author><pubDate>Tue, 21 May 2013 07:35:38 GMT</pubDate><guid isPermaLink="false">New Post: How can I create polygons in Farseer 3.3.1? 20130521073538A</guid></item><item><title>New Post: How can I create polygons in Farseer 3.3.1?</title><link>http://farseerphysics.codeplex.com/discussions/444315</link><description>&lt;div style="line-height: normal;"&gt;Try changing &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;List&amp;lt;Fixture&amp;gt; compund = FixtureFactory.CreateCompoundPolygon(world, _list, 1);
compund[0].Body.BodyType = BodyType.Dynamic;&lt;/code&gt;&lt;/pre&gt;

to &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;Body body = BodyFactory.CreateCompoundPolygon(world, _list, 1);
body.BodyType = BodyType.Dynamic;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>streikbrecher</author><pubDate>Mon, 20 May 2013 23:15:50 GMT</pubDate><guid isPermaLink="false">New Post: How can I create polygons in Farseer 3.3.1? 20130520111550P</guid></item><item><title>New Post: How can I use the ContactListener?</title><link>http://farseerphysics.codeplex.com/discussions/444259</link><description>&lt;div style="line-height: normal;"&gt;Maybe you can solve your issue with the EventHandlers, that exist for Separation and Collision.&lt;br /&gt;
This one for example, fires on collision and allows you to accept or deny to collision by returning true or false.&lt;br /&gt;
In the EventHandler, you also have access to the contact. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;        public void LoadContent()
        {
           //Add Event
           body.OnCollision += new OnCollisionEventHandler(body_OnCollision); //IntelliSense loves them
        }

        bool body_OnCollision(Fixture fixtureA, Fixture fixtureB, Dynamics.Contacts.Contact contact)
        {
            return true;
        }&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>streikbrecher</author><pubDate>Mon, 20 May 2013 23:08:43 GMT</pubDate><guid isPermaLink="false">New Post: How can I use the ContactListener? 20130520110843P</guid></item><item><title>New Post: How can I use the ContactListener?</title><link>http://farseerphysics.codeplex.com/discussions/444259</link><description>&lt;div style="line-height: normal;"&gt;I want to implement this ContactListener in my code, but I don't know how to do that because this is a box2d example and not a Farseer example. I want to use the PreSolve method in the ContactListener.&lt;br /&gt;
box2d manual(9.4 ContactListener): &lt;a href="http://www.box2d.org/manual.html#_Toc258082975" rel="nofollow"&gt;http://www.box2d.org/manual.html#_Toc258082975&lt;/a&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;class MyContactListener : public b2ContactListener

{

public:

  void BeginContact(b2Contact* contact)

  { /* handle begin event */ }

 

  void EndContact(b2Contact* contact)

  { /* handle end event */ }

 

  void PreSolve(b2Contact* contact, const b2Manifold* oldManifold)

  { /* handle pre-solve event */ }

 

  void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse)

  { /* handle post-solve event */ }

};&lt;/code&gt;&lt;/pre&gt;

Is it possible to use a similar ContactListener in Farseer? How can I do that?&lt;br /&gt;
&lt;/div&gt;</description><author>Wizard999</author><pubDate>Mon, 20 May 2013 22:56:27 GMT</pubDate><guid isPermaLink="false">New Post: How can I use the ContactListener? 20130520105627P</guid></item><item><title>New Post: How can I use the ContactListener?</title><link>http://farseerphysics.codeplex.com/discussions/444259</link><description>&lt;div style="line-height: normal;"&gt;Hello,&lt;br /&gt;
you might want to access the contactList of a certain body. &lt;br /&gt;
So here's an example in which I use the contactList to cycle through the contacts of myBody:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;            Dynamics.Contacts.ContactEdge cEdge = myBody.ContactList;
                do
                {
                    //Do sth with the bodies in contact
                    //Use cEdge.Contact.FixtureA.Body or cEdge.Contact.FixtureB.Body to access individual bodies

                    cEdge  = cEdge.Next;
                }
                while (cEdge != null);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>streikbrecher</author><pubDate>Mon, 20 May 2013 22:17:35 GMT</pubDate><guid isPermaLink="false">New Post: How can I use the ContactListener? 20130520101735P</guid></item><item><title>New Post: Balls not bouncing!!!</title><link>http://farseerphysics.codeplex.com/discussions/443947</link><description>&lt;div style="line-height: normal;"&gt;Experiment with the friction and restitution on both bodies... Restitution controls the &amp;quot;bounciness&amp;quot; but you need friction as well.&lt;br /&gt;
&lt;br /&gt;
Hope that helps,&lt;br /&gt;
Mike.&lt;br /&gt;
&lt;/div&gt;</description><author>mheydlauf</author><pubDate>Mon, 20 May 2013 18:37:15 GMT</pubDate><guid isPermaLink="false">New Post: Balls not bouncing!!! 20130520063715P</guid></item><item><title>New Post: How can I create polygons in Farseer 3.3.1?</title><link>http://farseerphysics.codeplex.com/discussions/444315</link><description>&lt;div style="line-height: normal;"&gt;I tried the example in the documentation but it isn't working. I always get these two error messages:&lt;br /&gt;
No overload for method 'CreatePolygon' takes 4 arguments	&lt;br /&gt;
'FarseerPhysics.Factories.FixtureFactory' does not contain a definition for 'CreateCompoundPolygon'	&lt;br /&gt;
&lt;br /&gt;
What is wrong? How can I create polygons?&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;//Create an array to hold the data from the texture
            uint[] data = new uint[polygonTexture.Width * polygonTexture.Height];
            //Transfer the texture data to the array
            polygonTexture.GetData(data); 
            //Find the vertices that makes up the outline of the shape in the texture
          Vertices  verts = PolygonTools.CreatePolygon(data, polygonTexture.Width, polygonTexture.Height, true);
            //For now we need to scale the vertices (result is in pixels, we use meters)
            Vector2 scale = new Vector2(3.50f, 1.50f);
            verts.Scale(ref scale);  
            //Since it is a concave polygon, we need to partition it into several smaller convex polygons
            _list = BayazitDecomposer.ConvexPartition(verts);   
            //Create a single body with multiple fixtures
            List&amp;lt;Fixture&amp;gt; compund = FixtureFactory.CreateCompoundPolygon(world, _list, 1);
            compund[0].Body.BodyType = BodyType.Dynamic; &lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>Wizard999</author><pubDate>Mon, 20 May 2013 17:54:51 GMT</pubDate><guid isPermaLink="false">New Post: How can I create polygons in Farseer 3.3.1? 20130520055451P</guid></item><item><title>New Post: How can I use the ContactListener?</title><link>http://farseerphysics.codeplex.com/discussions/444259</link><description>&lt;div style="line-height: normal;"&gt;I downloaded Farseer Physics Engine 3.3.1 Samples XNA(Recommended Download), but I can not find a class named ContactListener in the Farseer folder. How can I use the ContactListener when there is no ContactListener class in the Farseer folder?&lt;br /&gt;
&lt;/div&gt;</description><author>Wizard999</author><pubDate>Mon, 20 May 2013 08:55:01 GMT</pubDate><guid isPermaLink="false">New Post: How can I use the ContactListener? 20130520085501A</guid></item><item><title>New Post: How can I create triangles?</title><link>http://farseerphysics.codeplex.com/discussions/444063</link><description>&lt;div style="line-height: normal;"&gt;I used pyramids in one game, but I'm sure you could adapt this to more generic triangles.&lt;br /&gt;
&lt;br /&gt;
So I have a create pyramid method:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;private static Vertices CreateSimplePyramid(float width, float height)
{
    Vertices vertices = new Vertices();
    vertices.Add(new Vector2(0f, -height * .5f));
    vertices.Add(new Vector2(-width * .5f, height * .5f));
    vertices.Add(new Vector2(width * .5f, height * .5f));
    return vertices;
}&lt;/code&gt;&lt;/pre&gt;

Then I create my pyramid as you would normally in Farseer, so code something like:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;_body = BodyFactory.CreateBody(_world, ConvertUnits.ToSimUnits(_position), this);
Vertices vertices = CreateSimplePyramid(ConvertUnits.ToSimUnits(bDef.blockWidth), ConvertUnits.ToSimUnits(bDef.blockHeight));
vertices.ForceCounterClockWise();
_shape = new PolygonShape(vertices, density);
_fixture = _body.CreateFixture(_shape);
... etc
&lt;/code&gt;&lt;/pre&gt;

Maybe also of use, I remember Farseer has some &amp;quot;decomposer&amp;quot; routines that will split larger shapes into triangles, that was either in the samples or there was a class like eg EarclipDecomposer.&lt;br /&gt;
&lt;/div&gt;</description><author>Beringela</author><pubDate>Mon, 20 May 2013 06:53:30 GMT</pubDate><guid isPermaLink="false">New Post: How can I create triangles? 20130520065330A</guid></item><item><title>New Post: Games That Use Farseer Physics Engine 3.x</title><link>http://farseerphysics.codeplex.com/discussions/224442</link><description>&lt;div style="line-height: normal;"&gt;&lt;a href="http://www.windowsphone.com/s?appid=1d4a2c7f-b5e4-4e66-9b60-d8e2718e8c99" rel="nofollow"&gt;http://www.windowsphone.com/s?appid=1d4a2c7f-b5e4-4e66-9b60-d8e2718e8c99&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
New game that using FPE&lt;br /&gt;
&lt;/div&gt;</description><author>vitaliy_gorlov</author><pubDate>Sun, 19 May 2013 21:03:14 GMT</pubDate><guid isPermaLink="false">New Post: Games That Use Farseer Physics Engine 3.x 20130519090314P</guid></item><item><title>New Post: Games That Use Farseer Physics Engine 3.x</title><link>http://farseerphysics.codeplex.com/discussions/224442</link><description>&lt;div style="line-height: normal;"&gt;Gerbil Physics is now available for Android devices, phones and tablets &lt;a href="https://play.google.com/store/apps/details?id=com.pencelgames.gerbilphysics" rel="nofollow"&gt;from the Google Play store&lt;/a&gt;, and coming soon to the Kindle Fire via Amazon's App Store.&lt;br /&gt;
&lt;br /&gt;
This is a port from the WP7 version to Android using MonoGame.  I don't think I needed to make any changes for Farseer to work under MonoGame, it Just Worked.&lt;br /&gt;
&lt;br /&gt;
Thanks to all behind Farseer for making this possible.&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://www.pencelgames.com/media/46/download/Gerbil%20Physics%20Screenshot%2001.png" alt="Image" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>Beringela</author><pubDate>Sun, 19 May 2013 16:41:49 GMT</pubDate><guid isPermaLink="false">New Post: Games That Use Farseer Physics Engine 3.x 20130519044149P</guid></item><item><title>New Post: Trouble with the Camera2D Class</title><link>http://farseerphysics.codeplex.com/discussions/444160</link><description>&lt;div style="line-height: normal;"&gt;Whoops never mind I solved it. Very silly mistake. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;   graphics.PreferredBackBufferWidth =  1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.ApplyChanges();
            
            cam2D = new Cam2d(GraphicsDevice);&lt;/code&gt;&lt;/pre&gt;

NOT &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;cam2D = new Cam2d(GraphicsDevice);
 graphics.PreferredBackBufferWidth =  1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.ApplyChanges();
            
           &lt;/code&gt;&lt;/pre&gt;

As you can see it's just about creating the new cam class after a resolution change. &lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://i.imgur.com/V4zXTYs.png" alt="woo!" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>ASlave2Gravity</author><pubDate>Sat, 18 May 2013 21:39:25 GMT</pubDate><guid isPermaLink="false">New Post: Trouble with the Camera2D Class 20130518093925P</guid></item><item><title>New Post: Trouble with the Camera2D Class</title><link>http://farseerphysics.codeplex.com/discussions/444160</link><description>&lt;div style="line-height: normal;"&gt;Hey all, &lt;br /&gt;
&lt;br /&gt;
I really need some help with camera tracking. I apply the cam track like so &lt;br /&gt;
&lt;pre&gt;&lt;code&gt; cam2D.TrackingBody = player.playerBody;
 cam2D.EnableTracking = true;&lt;/code&gt;&lt;/pre&gt;

But for some reason the player is not the centre of the screen? &lt;br /&gt;
&lt;br /&gt;
Like so:&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://i.imgur.com/w4u2gmx.png" alt="Player Screen shot" /&gt; &lt;br /&gt;
&lt;br /&gt;
I have no idea why this is happening&lt;br /&gt;
&lt;br /&gt;
All the best,&lt;br /&gt;
&lt;br /&gt;
ASlave2Gravity &lt;br /&gt;
&lt;/div&gt;</description><author>ASlave2Gravity</author><pubDate>Sat, 18 May 2013 21:23:42 GMT</pubDate><guid isPermaLink="false">New Post: Trouble with the Camera2D Class 20130518092342P</guid></item><item><title>New Post: Mario jumps not correctly</title><link>http://farseerphysics.codeplex.com/discussions/443487</link><description>&lt;div style="line-height: normal;"&gt;Oh thank you for the Link. I'm looking for it too. :D&lt;br /&gt;
&lt;/div&gt;</description><author>johnnysayasane</author><pubDate>Fri, 17 May 2013 17:26:49 GMT</pubDate><guid isPermaLink="false">New Post: Mario jumps not correctly 20130517052649P</guid></item><item><title>New Post: How can I create triangles?</title><link>http://farseerphysics.codeplex.com/discussions/444063</link><description>&lt;div style="line-height: normal;"&gt;How can I create triangles in Farseer? I have no clue how to do that.&lt;br /&gt;
&lt;/div&gt;</description><author>Wizard999</author><pubDate>Fri, 17 May 2013 14:19:51 GMT</pubDate><guid isPermaLink="false">New Post: How can I create triangles? 20130517021951P</guid></item><item><title>New Post: Balls not bouncing!!!</title><link>http://farseerphysics.codeplex.com/discussions/443947</link><description>&lt;div style="line-height: normal;"&gt;I created a fixture called Bolinha1 (Ball1), and gave it some speed by applying impulse onto it in the inicialization:&lt;br /&gt;
&lt;br /&gt;
Bolinha1 = FixtureFactory.AttachCircle(TelaParaMundo(128,pixelspormetro)/2, 1f, CorpoBolinha1);&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;        Bolinha1.Restitution = 0.98f;
        Bolinha1.Friction = 0f;
        Bolinha1.Body.LinearDamping = 0f;
        Bolinha1.Body.FixedRotation = true;
        Bolinha1.Body.LinearDamping = 0f;                                                  
        Bolinha1.Body.AngularDamping = 0f;
        Bolinha1.Body.Inertia = 0;
        Bolinha1.Body.ApplyLinearImpulse(new Vector2(500, 0));
&lt;/code&gt;&lt;/pre&gt;

After That, i inicialize four edges, to delimit the screen:&lt;br /&gt;
&lt;br /&gt;
for (int i = 0; i &amp;lt; 4; i++)&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;        {
            SideBody[i] = BodyFactory.CreateBody(world);
            SideBody[i].BodyType = BodyType.Static;
            SideBody[i].Restitution = 0.95f;
            SideBody[i].Friction = 0f;
            SideBody[i].LinearDamping = 0f;

        }

        Side[0] = FixtureFactory.AttachEdge(new Vector2(0, 0), new Vector2(0, 45), CorpoBorda[0]);
        Side[1] = FixtureFactory.AttachEdge(new Vector2(0, 45), new Vector2(80, 45), CorpoBorda[1]);
        Side[2] = FixtureFactory.AttachEdge(new Vector2(80, 45), new Vector2(80, 0), CorpoBorda[2]);
        Side[3] = FixtureFactory.AttachEdge(new Vector2(80, 0), new Vector2(0, 0), CorpoBorda[3]);

        for (int i = 0; i &amp;lt; 4; i++)
        {
            Side[i].Restitution = 0.98f;
            Side[i].Friction = 0f;
            Side[i].Body.LinearDamping = 0f;
            Side[i].Body.AngularDamping = 0f;
        }
&lt;/code&gt;&lt;/pre&gt;

, and then use only&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;        world.Step((float)gameTime.TotalGameTime.TotalMilliseconds * 0.01f);
        world.ClearForces();
&lt;/code&gt;&lt;/pre&gt;

as my update code.The point is, the ball sticks to the side, no matter which angle of module i assign to the impulse, and if the impulse is great enough the ball &amp;quot;rolls&amp;quot; along the edge. I also tried tinkering with its density, but had no positive results. Can anyone help me??&lt;br /&gt;
&lt;/div&gt;</description><author>cristianormd</author><pubDate>Thu, 16 May 2013 18:15:10 GMT</pubDate><guid isPermaLink="false">New Post: Balls not bouncing!!! 20130516061510P</guid></item><item><title>New Post: Mario jumps not correctly</title><link>http://farseerphysics.codeplex.com/discussions/443487</link><description>&lt;div style="line-height: normal;"&gt;johnnysayasane is right, you need an additional &amp;quot;foot sensor&amp;quot; body to use for your collision detection.  I found this article very helpful when solving a similar problem: &lt;a href="http://www.iforce2d.net/b2dtut/jumpability" rel="nofollow"&gt;http://www.iforce2d.net/b2dtut/jumpability&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
Mike.&lt;br /&gt;
&lt;/div&gt;</description><author>mheydlauf</author><pubDate>Wed, 15 May 2013 15:11:45 GMT</pubDate><guid isPermaLink="false">New Post: Mario jumps not correctly 20130515031145P</guid></item></channel></rss>