intial commit

This commit is contained in:
Caleb Sandford deQuincey
2025-06-27 23:27:49 +01:00
commit ecdd3e2a9e
31269 changed files with 4937644 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using RaycastPro.Editor;
#endif
namespace RaycastPro.Sensor
{
[RequireComponent(typeof(Animator))]
public sealed class AvatarDefinition : BaseUtility
{
public Animator animator;
public List<HumanBodyBones> bodyBones = new List<HumanBodyBones>();
public List<Transform> bones = new List<Transform>();
void Start()
{
SyncBones();
}
public void SyncBones()
{
if (!animator) animator = GetComponentInChildren<Animator>();
bones.Clear();
foreach (var humanBodyBones in bodyBones)
{
var t = animator.GetBoneTransform(humanBodyBones);
if (!t) continue;
bones.Add(t);
}
}
public override bool Performed { get; protected set; }
protected override void OnCast() { }
#if UNITY_EDITOR
internal override string Info => "Definition an Avatar bones for add more visual acuity in characters."+ HUtility + HPreview;
internal override void OnGizmos()
{
foreach (var bone in bones)
{
Gizmos.DrawWireSphere(bone.position, DotSize);
}
}
internal override void EditorPanel(SerializedObject _so, bool hasMain = true, bool hasGeneral = true, bool hasEvents = true,
bool hasInfo = true)
{
if (hasMain)
{
if (GUILayout.Button("Human Preset"))
{
bodyBones.Clear();
bodyBones.Add(HumanBodyBones.Head);
bodyBones.Add(HumanBodyBones.Chest);
bodyBones.Add(HumanBodyBones.LeftHand);
bodyBones.Add(HumanBodyBones.RightHand);
bodyBones.Add(HumanBodyBones.LeftFoot);
bodyBones.Add(HumanBodyBones.RightFoot);
SyncBones();
}
RCProEditor.PropertyArrayField(_so.FindProperty(nameof(bodyBones)), "Bones".ToContent("Bondes"),
(i) => $"Bone {i+1}".ToContent($"Index {i}"));
}
if (hasGeneral)
{
BaseField(_so);
}
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: b828449eeb4ce75468927b8d45f7242c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 7e8a6a717b1d14f4cb9ae1f25b2df02b, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 214714
packageName: RaycastPro
packageVersion: 1.1.4
assetPath: Assets/Plugins/RaycastPro/Core/Utility/AvatarDefinition.cs
uploadId: 765145

View File

@@ -0,0 +1,201 @@
namespace RaycastPro.Sensor
{
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[RequireComponent(typeof(MeshCollider))]
public sealed class FOVMesh : BaseUtility
{
[Tooltip("Length of the view cone.")]
public float Length = 5f;
[Tooltip("Base size of the cone.")]
public float BaseSize = 0.5f;
[Range(1f, 180f)]
public float HorizontalFOV = 90f;
[Range(1f, 180f)]
public float VerticalFOV = 90f;
[Range(3, 32)]
public int SegmentCount = 8;
Mesh fovMesh = new Mesh();
public Mesh GetFOVMesh => fovMesh;
public MeshCollider meshCollider = new MeshCollider();
private void Reset()
{
// تلاش برای گرفتن MeshCollider
meshCollider = GetComponent<MeshCollider>();
// اگر وجود نداشت، خودش اضافه کند
if (meshCollider == null)
{
meshCollider = gameObject.AddComponent<MeshCollider>();
Debug.Log("MeshCollider was missing. A new one was added automatically to: " + gameObject.name);
}
}
// عرض مربع ابتدایی
public float BaseDepth = 0.001f; // چقدر عقب‌تر از نقطه شروع قرار بگیرد
void GenerateFOVMeshCollider()
{
// 4 vertex for base quad + 1 center + grid
int baseVertexCount = 4;
int baseTriangleCount = 2 * 3;
int gridVertexCount = 1 + SegmentCount * SegmentCount;
int gridTriangleCount = (SegmentCount - 1) * (SegmentCount - 1) * 2 * 3;
int totalVertices = baseVertexCount + gridVertexCount;
int totalTriangles = baseTriangleCount + gridTriangleCount;
Vector3[] vertices = new Vector3[totalVertices];
int[] triangles = new int[totalTriangles];
// 🟩 Base quad setup (مربع در پشت دید)
Vector3 baseDir = Quaternion.Euler(0, 0, 0) * Vector3.forward; // جهت وسط
Vector3 baseCenter = -baseDir * BaseDepth;
// بدست آوردن جهت‌های عمودی و افقی نسبت به جهت میانی
Vector3 right = Quaternion.Euler(0, 90, 0) * baseDir;
Vector3 up = Quaternion.Euler(-90, 0, 0) * baseDir;
float half = BaseSize * 0.5f;
vertices[0] = baseCenter + (-right - up) * half;
vertices[1] = baseCenter + (right - up) * half;
vertices[2] = baseCenter + (-right + up) * half;
vertices[3] = baseCenter + (right + up) * half;
// 🔺 دو مثلث پایه
int tri = 0;
triangles[tri++] = 0;
triangles[tri++] = 2;
triangles[tri++] = 1;
triangles[tri++] = 1;
triangles[tri++] = 2;
triangles[tri++] = 3;
// ⚙️ رأس مرکز مخروط
int offset = baseVertexCount;
vertices[offset] = Vector3.zero;
int index = offset + 1;
for (int y = 0; y < SegmentCount; y++)
{
float pitch = Mathf.Lerp(-VerticalFOV / 2f, VerticalFOV / 2f, y / (float)(SegmentCount - 1));
for (int x = 0; x < SegmentCount; x++)
{
float yaw = Mathf.Lerp(-HorizontalFOV / 2f, HorizontalFOV / 2f, x / (float)(SegmentCount - 1));
Vector3 dir = Quaternion.Euler(pitch, yaw, 0f) * Vector3.forward;
vertices[index++] = dir.normalized * Length;
}
}
// ⛓️ مثلث‌های مش اصلی
for (int y = 0; y < SegmentCount - 1; y++)
{
for (int x = 0; x < SegmentCount - 1; x++)
{
int i0 = offset + 1 + y * SegmentCount + x;
int i1 = i0 + 1;
int i2 = i0 + SegmentCount;
int i3 = i2 + 1;
triangles[tri++] = i0;
triangles[tri++] = i2;
triangles[tri++] = i1;
triangles[tri++] = i1;
triangles[tri++] = i2;
triangles[tri++] = i3;
}
}
// 📦 ساخت مش
if (fovMesh == null)
fovMesh = new Mesh { name = "FOV_Mesh" };
else
fovMesh.Clear();
// بررسی محدودیت کانکس مش
int triangleCount = triangles.Length / 3;
if (triangleCount > 255)
{
Debug.LogWarning($"FOV Mesh has {triangleCount} triangles, which exceeds Unity's convex mesh limit. Reducing SegmentCount.");
while (((SegmentCount - 1) * (SegmentCount - 1) * 2 + 2) > 255 && SegmentCount > 2)
SegmentCount--;
GenerateFOVMeshCollider(); // دوباره تولید کن
return;
}
fovMesh.vertices = vertices;
fovMesh.triangles = triangles;
fovMesh.RecalculateNormals();
fovMesh.RecalculateBounds();
// جلوگیری از تجاوز محدودیت کانکس
bool forceNonConvex = triangles.Length / 3 > 255;
if (forceNonConvex)
Debug.LogWarning($"FOV Mesh has too many triangles ({triangles.Length / 3}). Using non-convex collider.");
meshCollider.sharedMesh = fovMesh;
meshCollider.convex = !forceNonConvex;
meshCollider.isTrigger = true;
}
public override bool Performed { get; protected set; }
protected override void OnCast()
{
GenerateFOVMeshCollider();
}
#if UNITY_EDITOR
internal override string Info => "Auxiliary tool for creating dynamic view FOV Mesh. Best suitable for Mesh Detector" + HUtility + HDependent;
internal override void OnGizmos()
{
if (IsSceneView) OnCast();
if (fovMesh == null) return;
Gizmos.color = Color.green;
foreach (var v in fovMesh.vertices)
{
Gizmos.DrawSphere(transform.TransformPoint(v), 0.05f);
}
}
internal override void EditorPanel(SerializedObject _so, bool hasMain = true, bool hasGeneral = true,
bool hasEvents = true,
bool hasInfo = true)
{
if (hasMain)
{
EditorGUILayout.PropertyField(_so.FindProperty(nameof(meshCollider)));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(Length)));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(BaseSize)));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(HorizontalFOV)));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(VerticalFOV)));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(SegmentCount)));
}
if (hasGeneral)
{
BaseField(_so);
}
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f8c8af5cff22a1143a3184e75cc5ec17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 009965e3d23f22841853a5beb3845073, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 214714
packageName: RaycastPro
packageVersion: 1.1.4
assetPath: Assets/Plugins/RaycastPro/Core/Utility/FOVMesh.cs
uploadId: 765145

View File

@@ -0,0 +1,154 @@
namespace RaycastPro.Sensor
{
using UnityEngine;
#if UNITY_EDITOR
using Editor;
using UnityEditor;
#endif
[AddComponentMenu("RaycastPro/Utility/" + nameof(PointSensor))]
public sealed class PointSensor : BaseSensor, IRadius
{
public enum DotType
{
Sphere,
Box
}
public DotType dotType = DotType.Sphere;
[SerializeField] private float radius = 2f;
[SerializeField] private float height;
public float Height
{
get => height;
set => height = Mathf.Max(0, value);
}
public float Radius
{
get => radius;
set => radius = Mathf.Max(0, value);
}
public Vector3 extents = Vector3.one;
public override bool Performed
{
get => performed;
protected set {}
}
private bool performed;
protected override void OnCast()
{
var _t = transform;
performed = false;
switch (dotType)
{
case DotType.Sphere:
if (height > 0)
{
var h = _t.up * height / 2;
performed = Physics.CheckCapsule(_t.position - h, _t.position + h, radius,
detectLayer.value, triggerInteraction);
}
else
{
performed = Physics.CheckSphere(_t.position, radius, detectLayer.value, triggerInteraction);
}
break;
case DotType.Box:
performed = Physics.CheckBox(_t.position, extents / 2, _t.rotation, detectLayer.value,
triggerInteraction);
break;
}
}
#if UNITY_EDITOR
internal override string Info => "Simply using for check, This point in collide or not?"+ HUtility + HAccurate + HIRadius;
internal override void OnGizmos()
{
if (IsSceneView) OnCast();
Gizmos.color = Handles.color = Performed ? DetectColor : DefaultColor;
var _t = transform;
switch (dotType)
{
case DotType.Sphere:
GizmoColor = Performed ? DetectColor : HelperColor;
if (radius == 0) DrawArrows();
else if (height > 0)
{
var h = _t.up * (height / 2);
DrawCapsuleLine(_t.position - h, _t.position + h, radius: radius, _t: _t);
}
else DrawSphere(_t.position, _t.up, radius);
break;
case DotType.Box:
if (extents == Vector3.zero)
{
Gizmos.color = Handles.color = Performed ? DetectColor : HelperColor;
DrawArrows();
}
Gizmos.matrix = _t.localToWorldMatrix;
Gizmos.DrawWireCube(Vector3.zero, extents);
break;
}
}
internal override void EditorPanel(SerializedObject _so, bool hasMain = true, bool hasGeneral = true,
bool hasEvents = true,
bool hasInfo = true)
{
if (hasMain)
{
dotType = RCProEditor.EnumLabelField(dotType, "Dot Type".ToContent(), 2);
DetectLayerField(_so);
switch (dotType)
{
case DotType.Sphere:
RadiusField(_so);
HeightField(_so);
break;
case DotType.Box:
EditorGUILayout.PropertyField(_so.FindProperty(nameof(extents)));
break;
}
}
if (hasGeneral)
{
BaseField(_so);
}
if (hasEvents)
{
EventsField(_so);
}
if (hasInfo)
{
InformationField(() =>
{
BeginHorizontal();
GUILayout.Label("Performed");
GUI.contentColor = Performed ? DetectColor : DefaultColor;
GUILayout.Label(Performed.ToString());
GUI.contentColor = RCProEditor.Aqua;
EndHorizontal();
});
}
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 5059d4e08e129ed4992ed638e71f5a61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bebf9eca7e1bbc94c8e369001522cd76, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 214714
packageName: RaycastPro
packageVersion: 1.1.4
assetPath: Assets/Plugins/RaycastPro/Core/Utility/PointSensor.cs
uploadId: 765145

View File

@@ -0,0 +1,248 @@
namespace RaycastPro.Sensor
{
using System.Collections.Generic;
using RaySensors;
using RaySensors2D;
using UnityEngine;
#if UNITY_EDITOR
using Editor;
using UnityEditor;
#endif
[AddComponentMenu("RaycastPro/Utility/" + nameof(RayLiner))]
public sealed class RayLiner : BaseUtility
{
public RaySensor raySensor;
public RaySensor2D raySensor2D;
public LineRenderer liner;
public bool cutOnHit;
public bool clamped;
public float basePosition;
public float endPosition = 1f;
private Vector3 _baseP, _tipP, _tipTarget;
private float _pos;
private (Vector3 point, int index) _p1, _p2;
private Vector3 _hitPoint;
private bool isDetect;
private int detectIndex;
private Vector3 dIndexPoint;
private bool isPathRay;
private List<Vector3> path = new List<Vector3>();
private List<Vector3> _tPath = new List<Vector3>();
private float sqrDis;
public override bool Performed { get; protected set; }
public void UpdateLiner()
{
if (!liner) return;
if (!raySensor && !raySensor2D) return;
if (raySensor)
{
_baseP = raySensor.Base;
_tipP = raySensor.Tip;
_tipTarget = raySensor.TipTarget;
_hitPoint = raySensor.hit.point;
isDetect = raySensor.hit.transform;
if (raySensor is PathRay _pathRay)
{
path = _pathRay.PathPoints;
detectIndex = _pathRay.DetectIndex;
isPathRay = true;
}
else isPathRay = false;
}
else
{
_baseP = raySensor2D.Base;
_tipP = raySensor2D.Tip;
_tipTarget = raySensor2D.TipTarget;
_hitPoint = raySensor2D.hit.point;
isDetect = raySensor2D.hit;
if (raySensor2D is PathRay2D _pathRay)
{
path = _pathRay.PathPoints.ToDepth(raySensor2D.z);
detectIndex = _pathRay.DetectIndex;
isPathRay = true;
}
else isPathRay = false;
}
if (isPathRay)
{
if (!clamped)
{
if (cutOnHit) liner.SetSlicedPosition(path, _tipTarget, detectIndex);
else
{
liner.positionCount = path.Count;
liner.SetPositions(path.ToArray());
}
}
else // PathRay Clamped
{
_p1 = path.GetPathInfo(basePosition);
_p2 = path.GetPathInfo(endPosition);
if (cutOnHit && isDetect) // Cut and detect Hit
{
dIndexPoint = path[detectIndex];
sqrDis = (_hitPoint - dIndexPoint).sqrMagnitude;
if (_p1.index < detectIndex + 1 || (_p1.index == detectIndex + 1 &&
(_p1.point - dIndexPoint).sqrMagnitude <=
sqrDis))
{
_tPath = new List<Vector3> {_p1.point};
var maxPoint = Mathf.Min(_p2.index, detectIndex + 1);
// Add remaining Points according to minimum index
for (var i = _p1.index; i < maxPoint; i++) _tPath.Add(path[i]);
if (detectIndex + 1 > _p2.index) _tPath.Add(_p2.point);
else
_tPath.Add((_p2.point - dIndexPoint).sqrMagnitude <= sqrDis
? _p2.point
: _hitPoint);
liner.positionCount = _tPath.Count;
liner.SetPositions(_tPath.ToArray());
}
else // base Point over of Hit Point
{
liner.positionCount = 0;
}
}
else // Cut Without Detection
{
_tPath = new List<Vector3>() {_p1.point};
liner.positionCount = _p2.index - _p1.index + 2;
for (var i = _p1.index; i < _p2.index; i++) _tPath.Add(path[i]);
_tPath.Add(_p2.point);
liner.SetPositions(_tPath.ToArray());
}
}
}
else // when normal ray
{
if (clamped)
{
liner.positionCount = 2;
if (cutOnHit)
{
var _pos = raySensor.Performed ? raySensor.hit.distance / raySensor.RayLength : 1f;
var _b = raySensor.Base;
if (_pos >= raySensor.linerBasePosition)
{
liner.SetPosition(0, Vector3.Lerp(_b, raySensor.Tip, raySensor.linerBasePosition));
liner.SetPosition(1, _pos < raySensor.linerEndPosition ? raySensor.TipTarget : Vector3.Lerp(_b, raySensor.Tip, raySensor.linerEndPosition));
}
else liner.positionCount = 0;
}
else
{
var _t = raySensor.Tip;
var _b = raySensor.Base;
liner.SetPosition(0, Vector3.Lerp(_b, _t, raySensor.linerBasePosition));
liner.SetPosition(1, Vector3.Lerp(_b, _t, raySensor.linerEndPosition));
}
}
else // USE Full Clamp
{
liner.positionCount = 2;
liner.SetPosition(0, _baseP);
liner.SetPosition(1, cutOnHit ? _tipTarget : _tipP);
}
}
}
protected override void OnCast()
{
UpdateLiner();
}
#if UNITY_EDITOR
internal override string Info => "Assigns a Line Renderer to the desired RaySource." + HDependent + HUtility;
internal override void OnGizmos()
{
if (IsSceneView && !IsPlaying)
{
raySensor?.Cast();
raySensor2D?.Cast();
UpdateLiner();
}
}
internal override void EditorPanel(SerializedObject _so, bool hasMain = true, bool hasGeneral = true,
bool hasEvents = true,
bool hasInfo = true)
{
if (hasMain)
{
if (!raySensor2D) EditorGUILayout.PropertyField(_so.FindProperty(nameof(raySensor)));
if (!raySensor) EditorGUILayout.PropertyField(_so.FindProperty(nameof(raySensor2D)));
if (liner) BeginVerticalBox();
BeginHorizontal();
var prop = _so.FindProperty(nameof(liner));
EditorGUILayout.PropertyField(prop, CLiner.ToContent(TLiner));
if (!liner && GUILayout.Button(CAdd, GUILayout.Width(50f)))
{
// Fixed Liner Problem
if (TryGetComponent(out LineRenderer lineRenderer)) liner = lineRenderer;
else
{
prop.objectReferenceValue = gameObject.AddComponent<LineRenderer>();
_so.ApplyModifiedProperties();
liner.material =
new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply"));
}
liner.endWidth = Mathf.Min(RCProPanel.linerMaxWidth, .1f);
liner.startWidth = Mathf.Min(RCProPanel.linerMaxWidth, .1f);
liner.numCornerVertices = Mathf.Min(0, 6);
liner.numCapVertices = Mathf.Min(0, 6);
UpdateLiner();
}
EndHorizontal();
#region Liner Setting
if (!liner) return;
EditorGUILayout.PropertyField(_so.FindProperty(nameof(clamped)));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(cutOnHit)));
GUI.enabled = clamped;
PropertyMinMaxField(_so.FindProperty(nameof(basePosition)), _so.FindProperty(nameof(endPosition)),
ref basePosition, ref endPosition, 0, 1);
GUI.enabled = true;
liner.startWidth = EditorGUILayout.Slider(CStartWidth, liner.startWidth, 0f, RCProPanel.linerMaxWidth);
liner.endWidth = EditorGUILayout.Slider(CEndWidth, liner.endWidth, 0f, RCProPanel.linerMaxWidth);
liner.numCapVertices = EditorGUILayout.IntField(CCap, liner.numCapVertices);
liner.numCornerVertices = EditorGUILayout.IntField(CCorner, liner.numCornerVertices);
GUI.backgroundColor = Color.white;
liner.colorGradient = EditorGUILayout.GradientField(CGradient, liner.colorGradient);
GUI.backgroundColor = RCProEditor.Violet;
EndVertical();
#endregion }
if (hasGeneral)
{
BaseField(_so);
}
if (hasInfo)
{
}
}
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 99d755bd8159e92459bd203b483cf293
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 7e30a6af0bdf96e4fb16a7c2bfbdcd49, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 214714
packageName: RaycastPro
packageVersion: 1.1.4
assetPath: Assets/Plugins/RaycastPro/Core/Utility/RayLiner.cs
uploadId: 765145

View File

@@ -0,0 +1,166 @@
namespace RaycastPro.Sensor
{
using System.Collections.Generic;
using RaySensors;
using RaySensors2D;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[AddComponentMenu("RaycastPro/Utility/" + nameof(RayStamp))]
public sealed class RayStamp : BaseUtility
{
public RaySensor raySensor;
public RaySensor2D raySensor2D;
public Transform stamp;
public override bool Performed { get; protected set; }
public float position;
public bool fixOnHit;
public float offset;
public bool AutoHide;
public WeightType weightType = WeightType.Distance;
public float weight;
public float distance;
[SerializeField] internal AxisRun syncStamp = new AxisRun();
private Vector3 _direction;
protected override void OnCast()
{
if (raySensor)
{
if (AutoHide) stamp.gameObject.SetActive(raySensor.Performed);
UpdateStamp();
}
else if (raySensor2D)
{
if (AutoHide) stamp.gameObject.SetActive(raySensor2D.Performed);
UpdateStamp();
}
}
private List<Vector3> rayPath;
private float edgeLength;
private void Reset()
{
if (TryGetComponent(out raySensor))
{ }
else TryGetComponent(out raySensor2D);
}
private void ApplyPosition(float lengthPos)
{
for (var i = 1; i < rayPath.Count; i++)
{
edgeLength = rayPath.GetEdgeLength(i);
if (lengthPos <= edgeLength)
{
stamp.position = Vector3.Lerp(rayPath[i - 1], rayPath[i], lengthPos / edgeLength);
_direction = rayPath[i] - rayPath[i - 1];
break;
}
lengthPos -= edgeLength;
}
}
private float _tDistance, _tLength;
private float TrueLength => (fixOnHit && raySensor.Performed) ? raySensor.HitLength : rayPath.GetPathLength();
private float TrueLength2D => (fixOnHit && raySensor2D.Performed) ? raySensor2D.HitLength : rayPath.GetPathLength();
public void UpdateStamp()
{
if (!stamp) return;
if (raySensor)
{
if (raySensor.cloneRaySensor && raySensor.cloneRaySensor.enabled) return;
raySensor.GetPath(ref rayPath);
_tLength = TrueLength;
_direction = stamp.forward;
}
else if (raySensor2D)
{
if (raySensor2D.cloneRaySensor && raySensor2D.cloneRaySensor.enabled) return;
raySensor2D.GetPath(ref rayPath);
_tLength = TrueLength2D;
_direction = stamp.forward;
}
switch (weightType)
{
case WeightType.Clamp:
_tDistance = weight * _tLength;
break;
case WeightType.Distance:
_tDistance = Mathf.Min(distance, _tLength);
break;
case WeightType.Offset:
{
_tDistance = _tLength - offset;
}
break;
}
ApplyPosition(_tDistance);
if (syncStamp.syncAxis)
{
syncStamp.SyncAxis(stamp, _direction);
}
}
#if UNITY_EDITOR
internal override string Info => "A controllable Transform handler that fits on anytype of Rays.." + HUtility + HDependent;
internal override void OnGizmos()
{
if (IsSceneView && !IsPlaying) OnCast();
}
internal override void EditorPanel(SerializedObject _so, bool hasMain = true, bool hasGeneral = true,
bool hasEvents = true,
bool hasInfo = true)
{
if (hasMain)
{
if (!raySensor2D)
{
EditorGUILayout.PropertyField(_so.FindProperty(nameof(raySensor)));
}
if (!raySensor)
{
EditorGUILayout.PropertyField(_so.FindProperty(nameof(raySensor2D)));
}
WeightField(_so.FindProperty(nameof(weightType)),
_so.FindProperty(nameof(weight)),
_so.FindProperty(nameof(distance)),
_so.FindProperty(nameof(offset)));
StampField(_so);
}
if (hasGeneral)
{
BaseField(_so);
}
}
private void StampField(SerializedObject _so)
{
if (stamp) BeginVerticalBox();
EditorGUILayout.ObjectField(_so.FindProperty(nameof(stamp)), CStamp.ToContent(TStamp));
if (!stamp) return;
EditorGUILayout.PropertyField(_so.FindProperty(nameof(fixOnHit)),
CStampOnHit.ToContent(TStampOnHit));
EditorGUILayout.PropertyField(_so.FindProperty(nameof(AutoHide)),
CStampAutoHide.ToContent(TStampAutoHide));
syncStamp.EditorPanel(_so.FindProperty(nameof(syncStamp)));
EndVertical();
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8f56eb215c5793c42b13f090d6753e00
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 37d87460bfa727448893ba9eb9fb27a8, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 214714
packageName: RaycastPro
packageVersion: 1.1.4
assetPath: Assets/Plugins/RaycastPro/Core/Utility/RayStamp.cs
uploadId: 765145