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

Manage to get an arrow body stick into other body

Mar 24, 2012 at 11:24 PM
Edited Mar 25, 2012 at 11:10 AM

Hello guys i'am very new to Farseer,

i created arrows as physics bodies.

Now i want to make the arrows stick into other bodies when they hit them.

But i got no idea how to manage this. I catch the OnCollision event and now i think i need to make joints?

How to manage this?


I also wondering how to manage a landscape which has no flat ground?

How to create custom shaped landscape ground? 

I tried to create landscape from a texture:

content = new ContentManager(screenManager.Game.Services, "Content");
            this._GrenGrassGround = content.Load<Texture2D>(@"Landcapes\Level1\Level1GrasGround");
            uint[] data = new uint[_GrenGrassGround.Width * _GrenGrassGround.Height];
            Vertices verts = PolygonTools.CreatePolygon(data, _GrenGrassGround.Width);
            Vector2 centroid = -verts.GetCentroid();
            verts.Translate(ref centroid);
            _GroundbBody = BodyFactory.CreatePolygon(_world, verts, 1f);
            _GroundbBody.BodyType = BodyType.Kinematic;
            _GroundbBody.Position = new Vector2(0, 2.8f);

Mar 25, 2012 at 11:34 AM

Check this tutorial for sticking the arrows: