コード例 #1
0
        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
ファイル: RadianF.cs プロジェクト: zwiglm/NeoAxisEngine
 public DegreeF InDegrees()
 {
     return(MathEx.RadianToDegree(value));
 }