示例#1
0
        void FixedUpdate()
        {
            float horizontal = _horizontalAction.axis * Speed;
            float vertical   = _verticalAction.axis * Speed;

            if (horizontal != 0f && vertical != 0)
            {
                horizontal /= MathHelper.TwoSqrt;
                vertical   /= MathHelper.TwoSqrt;
            }

            _steeringOutput.Reset();
            _steeringOutput.IsInstantVelocity = true;

            _steeringOutput.Linear = new Vector2(horizontal, vertical);

            _body.Actualize(_steeringOutput, Speed, Time.fixedDeltaTime);
        }