Beispiel #1
0
        private void UpdatePolygons()
        {
            body.angle    = Rotation;
            body.position = Position;
            for (int j = 0; j < body.shapes.Count; j++)
            {
                body.shapes[j].rot = new Vector2((float)Math.Cos(body.angle), (float)Math.Sin(body.angle));
                for (int i = 0; i < body.shapes[j].VertexsCount; i++)
                {
                    body.shapes[j].v[i] = body.shapes[j].body.position + V2Extend.Rotate(body.shapes[j].v_base[i], body.shapes[j].rot);

                    body.shapes[j].ed[i].n = V2Extend.Rotate(body.shapes[j].ed_base[i].n, body.shapes[j].rot);
                    body.shapes[j].ed[i].d = V2Extend.Dot(body.shapes[j].body.position, body.shapes[j].ed[i].n) + body.shapes[j].ed_base[i].d;
                }
                body.shapes[j].broadphase = Poly.GetBroadphase(body.shapes[j]);
            }
        }