1
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using System.Reflection;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using System;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
@@ -39,6 +39,24 @@ namespace BITKit
|
||||
}
|
||||
public static partial class MathV
|
||||
{
|
||||
public static bool InFovRange(Vector3 selfPosition,Vector3 selfForward, Vector3 target, float fov)
|
||||
{
|
||||
var direction = target - selfPosition;
|
||||
var angle = Vector3.Angle(direction, selfForward);
|
||||
return angle < fov;
|
||||
}
|
||||
public static bool IsForward(Vector3 selfPosition, Vector3 selfForward,Vector3 targetPos)
|
||||
{
|
||||
// Get the direction from referencePos to targetPos
|
||||
Vector3 directionToTarget = (targetPos - selfPosition).normalized;
|
||||
|
||||
// Calculate the dot product
|
||||
float dotProduct = Vector3.Dot(directionToTarget, selfForward);
|
||||
|
||||
// If dot product is greater than 0, targetPos is in front of referencePos
|
||||
return dotProduct > 0;
|
||||
}
|
||||
|
||||
// 对于 Vector3
|
||||
public static Vector3 AlignRotation(Vector3 eulerAngles, float angleIncrement)
|
||||
{
|
||||
|
@@ -28,6 +28,12 @@ namespace BITKit
|
||||
|
||||
private readonly List<T> _list=new();
|
||||
|
||||
public int DefaultCapacity
|
||||
{
|
||||
get => defaultCapacity;
|
||||
set => defaultCapacity = value;
|
||||
}
|
||||
|
||||
public T Get(T element = null, Transform _root = null)
|
||||
{
|
||||
if (_list.Count == defaultCapacity)
|
||||
|
Reference in New Issue
Block a user