Skip to content

Instantly share code, notes, and snippets.

@SamatKadyrov
Created November 30, 2023 18:12
Show Gist options
  • Save SamatKadyrov/6ef008dce1dbdc6283215415e3d5dc5a to your computer and use it in GitHub Desktop.
Save SamatKadyrov/6ef008dce1dbdc6283215415e3d5dc5a to your computer and use it in GitHub Desktop.
using UnityEngine;
public class VectorOperations : MonoBehaviour
{
[SerializeField] private Vector3 _playerPosition = new Vector2(3, 1);
[SerializeField] private Vector3 _guardPosition = new Vector2(1, 2);
private float _dotResult;
private Vector3 _fieldOfView = new Vector2(1, 1);
private void Start()
{
_dotResult = Vector2.Dot(_fieldOfView, (_playerPosition - _guardPosition));
Debug.Log(_dotResult); // Выведет 1, значит угол острый
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment