Example #1
0
    void LookAtTarget()
    {
        Quaternion look = StaticMaths.GetLookRotation(target.transform.position, transform.position, transform.forward, out bool rotate, 1);

        if (rotate)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, look, Time.deltaTime * aISettings.rotSpeed);
        }
    }
Example #2
0
    void RotateToTarget()
    {
        Transform player = playerAnim.transform.parent;
        Vector3   target = _lastEndPos;

        target.y = player.position.y;
        Quaternion rot = StaticMaths.GetLookRotation(target, player.position, player.forward, out bool shouldRotate, 1);

        if (shouldRotate)
        {
            player.rotation = Quaternion.Slerp(player.rotation, rot, Time.deltaTime * playerTurnSpeed);
        }
    }