示例#1
0
        public void ShowPositionAndAngle()
        {
            #region animate offsetTexCoords
            if (AngularVelocity == 0 && LinearVelocityY == 0)
            {
            }
            else
            {
                visual.Animate(LinearVelocityY);
            }
            #endregion


            visual.SetPositionAndAngle(
                body.GetPosition().x * 16,
                body.GetPosition().y * 16,

                body.GetAngle()
                );


            #region Content_layer0_tracks
            if (!prev)
            {
                prev  = true;
                prevx = this.body.GetPosition().x;
                prevy = this.body.GetPosition().y;
            }
            else
            {
                var p = this.body.GetPosition();


                var distance = X.GetLength(
                    new __vec2(
                        (float)(p.x - prevx),
                        (float)(p.y - prevy)
                        )
                    );

                if (distance > 2)
                {
                    var tracks0 = new Image(textures.tracks0()).AttachTo(Context.Content_layer0_tracks);

                    var cm = new Matrix();

                    cm.translate(-64, -64);
                    cm.rotate(this.body.GetAngle() - Math.PI / 2);
                    cm.translate(
                        p.x * 16.0,
                        p.y * 16.0
                        );

                    tracks0.transformationMatrix = cm;

                    prevx = p.x;
                    prevy = p.y;
                }
            }
            #endregion
        }