public override void UpdateDataFromPhysicsEngine()
        {
            if (MotionType.Value == MotionTypeEnum.Dynamic && rigidBody != null)
            {
                var position = Physics2DUtility.Convert(rigidBody.Position);
                var rotation = -rigidBody.Rotation;

                var oldT = Transform.Value;

                Matrix3F.FromRotateByZ(rotation, out var mat3);
                var rot2 = mat3.ToQuaternion();
                //var rot2 = new Angles( 0, 0, MathEx.RadianToDegree( rot ) );

                var newT = new Transform(new Vector3(position.X, position.Y, oldT.Position.Z), rot2, oldT.Scale);

                try
                {
                    updatePropertiesWithoutUpdatingBody = true;
                    Transform       = newT;
                    LinearVelocity  = Physics2DUtility.Convert(rigidBody.LinearVelocity);
                    AngularVelocity = MathEx.RadianToDegree(rigidBody.AngularVelocity);
                }
                finally
                {
                    updatePropertiesWithoutUpdatingBody = false;
                }
            }
        }
예제 #2
0
 public DegreeF InDegrees()
 {
     return(MathEx.RadianToDegree(value));
 }