Polygon fals into other polygon

Sep 13, 2008 at 4:02 PM

Hello. Can somebody help me=)?

I using silverlight 2 beta 2 ,farseer physics 1.0.0.5  .When i make rectangle collisions works fine, but when i make polygon then collisions not work right.

source code: http://rapidshare.com/files/144962042/SilverlightGame.zip.html

there is function how i make polygon

  public void Load()
{
_Canvas = new Canvas();
Polygon _Polygon = new Polygon();
foreach (Point _point in _Points)
{
_Polygon.Points.Add(_point);
}
TranslateTransform _translateTransform1 = new TranslateTransform();
_translateTransform1.X = -_Width / 2;
_translateTransform1.Y = -_Heihgt / 2;

for (int _int = 0; _int < _Polygon.Points.Count; _int++)
{
_Polygon.Points[_int] = _translateTransform1.Transform(_Polygon.Points[_int]);
}


//_Polygon.Fill = new SolidColorBrush(Colors.Blue);
_Polygon.Stroke = new SolidColorBrush(Colors.Blue);
_Polygon.StrokeThickness = 2;
_Canvas.Children.Add(_Polygon);
_body = new Body();
_body.Mass = mass;
_body.MomentOfInertia = mass*(_Width*_Width + _Heihgt*_Heihgt)/12;

TransformGroup _transformGroup;
_Canvas.RenderTransform = _transformGroup = new TransformGroup();
_rotateTransform = new RotateTransform();
_translateTransform = new TranslateTransform();
_transformGroup.Children.Add(_rotateTransform);
_transformGroup.Children.Add(_translateTransform);

Vertices _Vertices = new Vertices();
foreach (Point _point in _Polygon.Points)
{
_Vertices.Add(new Vector2((float) _point.X, (float) _point.Y));
}
_geom = new Geom(_body, _Vertices, new Vector2(), 0, 5.8f);

_PhysicsSimulator.Add(_geom);
_PhysicsSimulator.Add(_body);

}

Polygon points are

  <_Points>
<Point>
<X>0</X>
<Y>0</Y>
</Point>
<Point>
<X>20</X>
<Y>20</Y>
</Point>
<Point>
<X>40</X>
<Y>40</Y>
</Point>
<Point>
<X>20</X>
<Y>60</Y>
</Point>
<Point>
<X>0</X>
<Y>80</Y>
</Point>
<Point>
<X>0</X>
<Y>60</Y>  
</Point>
<Point>
<X>0</X>
<Y>40</Y>
</Point>
<Point>
<X>0</X>
<Y>20</Y>
</Point>
<Point>
<X>0</X>
<Y>0</Y>
</Point>
</_Points>