|
|
|
@@ -4,6 +4,7 @@ using BrewMonster.Scripts.Ornament;
|
|
|
|
|
using BrewMonster.Scripts.World;
|
|
|
|
|
using CSNetwork.GPDataType;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using static BrewMonster.CECHostMove;
|
|
|
|
@@ -124,16 +125,25 @@ namespace BrewMonster
|
|
|
|
|
|
|
|
|
|
if ((pEnvTrc.dwCheckFlag & CDR_EVN.CDR_BRUSH) == CDR_EVN.CDR_BRUSH)
|
|
|
|
|
{
|
|
|
|
|
float fFractionBrush = 100f;
|
|
|
|
|
Vector3 v3Normal = Vector3.zero;
|
|
|
|
|
dir = vDelta;
|
|
|
|
|
//hits = new RaycastHit[5];
|
|
|
|
|
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
|
|
|
|
|
if (countHits > 0)
|
|
|
|
|
for(int i = 0; i < countHits; i++)
|
|
|
|
|
{
|
|
|
|
|
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
|
|
|
|
pEnvTrc.fFraction = (hits[0].distance) / vDelta.magnitude;
|
|
|
|
|
pEnvTrc.vHitNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
|
|
|
|
|
pEnvTrc.dwClsFlag = CDR_EVN.CDR_BRUSH;
|
|
|
|
|
if (hits[i].distance > 0f)
|
|
|
|
|
{
|
|
|
|
|
float fFraction = (hits[i].distance) / vDelta.magnitude;
|
|
|
|
|
if(fFraction < fFractionBrush)
|
|
|
|
|
{
|
|
|
|
|
fFractionBrush = fFraction;
|
|
|
|
|
v3Normal = hits[i].normal;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pEnvTrc.fFraction = fFractionBrush;
|
|
|
|
|
pEnvTrc.vHitNormal = EC_Utility.ToA3DVECTOR3(v3Normal);
|
|
|
|
|
pEnvTrc.dwClsFlag = CDR_EVN.CDR_BRUSH;
|
|
|
|
|
}
|
|
|
|
|
if ((pEnvTrc.dwCheckFlag & CDR_EVN.CDR_TERRAIN) == CDR_EVN.CDR_TERRAIN)
|
|
|
|
|
{
|
|
|
|
@@ -521,6 +531,7 @@ namespace BrewMonster
|
|
|
|
|
|
|
|
|
|
while (nTry < MAX_TRY)
|
|
|
|
|
{
|
|
|
|
|
//hits = new RaycastHit[5];
|
|
|
|
|
vDelta = vVelocity * fTime;
|
|
|
|
|
vFinalPos = vStart;
|
|
|
|
|
float fDeltaDist = vDelta.Magnitude();
|
|
|
|
@@ -552,6 +563,7 @@ namespace BrewMonster
|
|
|
|
|
{
|
|
|
|
|
//a_LogOutput(1, "bClear = true");
|
|
|
|
|
vFinalPos = vStart + vDelta;
|
|
|
|
|
Debug.LogError("bClear = true " + vFinalPos);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -564,13 +576,26 @@ namespace BrewMonster
|
|
|
|
|
env_trace_t tmpInfo = new env_trace_t();
|
|
|
|
|
tmpInfo.vStart = vStart;
|
|
|
|
|
tmpInfo.vDelta = new A3DVECTOR3(0.0f, CDRInfo.fStepHeight, 0.0f);
|
|
|
|
|
tmpInfo.vExt = vExt;
|
|
|
|
|
tmpInfo.vExt = new A3DVECTOR3(vExt.x, 0.01f, vExt.z);
|
|
|
|
|
//@note : need check terrain?? By Kuiwu[8/10/2005]
|
|
|
|
|
tmpInfo.dwCheckFlag = CDR_EVN.CDR_BRUSH | CDR_EVN.CDR_TERRAIN;
|
|
|
|
|
tmpInfo.vTerStart = vStart;
|
|
|
|
|
tmpInfo.vTerStart.y -= vExt.y;
|
|
|
|
|
//bPull = !CollideWithEnv(ref tmpInfo);
|
|
|
|
|
Debug.LogError("CheckFootStepUp");
|
|
|
|
|
bPull = !CheckFootStepUp(tmpInfo);
|
|
|
|
|
|
|
|
|
|
bPull = !CollideWithEnv(ref tmpInfo);
|
|
|
|
|
//int count1 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(tmpInfo.vStart), EC_Utility.ToVector3(tmpInfo.vDelta).normalized, hits, EC_Utility.ToVector3(tmpInfo.vDelta).magnitude, BrushMask | TerrainMask);
|
|
|
|
|
//bPull = !(count1 < 0);
|
|
|
|
|
//if(count1 > 0)
|
|
|
|
|
//{
|
|
|
|
|
// Debug.DrawLine(EC_Utility.ToVector3(tmpInfo.vStart), hits[0].point, Color.yellow, 10f);
|
|
|
|
|
//}
|
|
|
|
|
//if(bPull == false)
|
|
|
|
|
//{
|
|
|
|
|
// BoxCastDrawer.Draw(EC_Utility.ToVector3(tmpInfo.vStart), EC_Utility.ToVector3(tmpInfo.vExt), EC_Utility.ToVector3(tmpInfo.vDelta).normalized,
|
|
|
|
|
// Quaternion.identity, EC_Utility.ToVector3(tmpInfo.vDelta).magnitude, hits, 1, nTry == 0 ? Color.red : Color.green, 10f);
|
|
|
|
|
//}
|
|
|
|
|
if (bPull)
|
|
|
|
|
{
|
|
|
|
|
vStart.y += CDRInfo.fStepHeight;
|
|
|
|
@@ -585,8 +610,8 @@ namespace BrewMonster
|
|
|
|
|
{
|
|
|
|
|
vDelta *= tmpInfo.fFraction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vDelta.SquaredMagnitude() < vExt.x * vExt.x * 4)
|
|
|
|
|
float value = vDelta.SquaredMagnitude();
|
|
|
|
|
if (value < (vExt.x * vExt.x * 4))
|
|
|
|
|
{
|
|
|
|
|
vStart.y -= CDRInfo.fStepHeight;
|
|
|
|
|
bPull = false;
|
|
|
|
@@ -661,7 +686,7 @@ namespace BrewMonster
|
|
|
|
|
groundTrc.fDeltaY = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!RetrieveSupportPlane(ref groundTrc))
|
|
|
|
|
if (!RetrieveSupportPlane(ref groundTrc, true))
|
|
|
|
|
{//@note : do NOT change position. By Kuiwu[14/9/2005]
|
|
|
|
|
CDRInfo.fMoveDist = 0.0f;
|
|
|
|
|
// if (groundTrc.bSupport)
|
|
|
|
@@ -674,6 +699,7 @@ namespace BrewMonster
|
|
|
|
|
if (groundTrc.bSupport)
|
|
|
|
|
{
|
|
|
|
|
vFinalPos = groundTrc.vEnd;
|
|
|
|
|
Debug.LogError("vFinalPos = " + vFinalPos);
|
|
|
|
|
if (!bJump)
|
|
|
|
|
{
|
|
|
|
|
vTPNormal = groundTrc.vHitNormal;
|
|
|
|
@@ -692,6 +718,28 @@ namespace BrewMonster
|
|
|
|
|
CDRInfo.vTPNormal = vTPNormal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static bool CheckFootStepUp(env_trace_t pEnvTrc)
|
|
|
|
|
{
|
|
|
|
|
Vector3 vExt = EC_Utility.ToVector3(pEnvTrc.vExt);
|
|
|
|
|
Vector3 vStart = EC_Utility.ToVector3(pEnvTrc.vStart);
|
|
|
|
|
Vector3 vDelta = EC_Utility.ToVector3(pEnvTrc.vDelta);
|
|
|
|
|
Vector3 dir = vDelta;
|
|
|
|
|
int countHits = 0;
|
|
|
|
|
float num = 10f;
|
|
|
|
|
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
|
|
|
|
|
if (countHits > 0)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < countHits; i++)
|
|
|
|
|
{
|
|
|
|
|
if (hits[i].collider != null && hits[i].point.y > (vStart.y + vExt.y))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//@desc : used to retrieve support plane (ground or brush), By Kuiwu[12/9/2005]
|
|
|
|
|
public struct ground_trace_t
|
|
|
|
|
{
|
|
|
|
@@ -704,7 +752,7 @@ namespace BrewMonster
|
|
|
|
|
public bool bSupport; //false if ground missed
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static bool RetrieveSupportPlane(ref ground_trace_t pTrc)
|
|
|
|
|
public static bool RetrieveSupportPlane(ref ground_trace_t pTrc, bool check = false)
|
|
|
|
|
{
|
|
|
|
|
A3DVECTOR3 vTerrainPos = new A3DVECTOR3(), vTerrainNormal = new A3DVECTOR3();
|
|
|
|
|
|
|
|
|
@@ -715,13 +763,15 @@ namespace BrewMonster
|
|
|
|
|
BrushTraceInfo trcInfo = new BrushTraceInfo();
|
|
|
|
|
trcInfo.Init(pTrc.vStart, new A3DVECTOR3(0.0f, -pTrc.fDeltaY, 0.0f), pTrc.vExt);
|
|
|
|
|
Vector3 hitPoint = new Vector3();
|
|
|
|
|
if (AABBCollideWithBrush(ref trcInfo, ref hitPoint))
|
|
|
|
|
if (AABBCollideWithBrush(ref trcInfo, ref hitPoint, check))
|
|
|
|
|
{
|
|
|
|
|
if (trcInfo.bStartSolid)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
pTrc.vEnd = trcInfo.vStart + trcInfo.vDelta * trcInfo.fFraction;
|
|
|
|
|
if(check)
|
|
|
|
|
Debug.LogError("trcInfo.fFraction = " + trcInfo.fFraction + " trcInfo.vStart = " + trcInfo.vStart + " pTrc.vEnd = " + pTrc.vEnd);
|
|
|
|
|
pTrc.vEnd.y = hitPoint.y + pTrc.vExt.y + 0.1f;
|
|
|
|
|
//if((pTrc.vEnd.y + 0.17f) < (hitPoint.y + pTrc.vExt.y + 0.1f))
|
|
|
|
|
//{
|
|
|
|
@@ -752,7 +802,7 @@ namespace BrewMonster
|
|
|
|
|
trcInfo.Init(pTrc.vStart, vDelta, pTrc.vExt);
|
|
|
|
|
pTrc.vHitNormal = vTerrainNormal;
|
|
|
|
|
pTrc.bSupport = true;
|
|
|
|
|
return !AABBCollideWithBrush(ref trcInfo);
|
|
|
|
|
return !AABBCollideWithBrush(ref trcInfo, ref hitPoint, check);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@@ -1004,7 +1054,7 @@ namespace BrewMonster
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool AABBCollideWithBrush(ref BrushTraceInfo brushTraceInfo, ref Vector3 hitPoint)
|
|
|
|
|
public static bool AABBCollideWithBrush(ref BrushTraceInfo brushTraceInfo, ref Vector3 hitPoint, bool check)
|
|
|
|
|
{
|
|
|
|
|
Vector3 vExt = EC_Utility.ToVector3(brushTraceInfo.vExtents);
|
|
|
|
|
Vector3 vStart = EC_Utility.ToVector3(brushTraceInfo.vStart);
|
|
|
|
@@ -1012,35 +1062,41 @@ namespace BrewMonster
|
|
|
|
|
Vector3 dir = vDelta;
|
|
|
|
|
int countHits = 0;
|
|
|
|
|
float num = 10f;
|
|
|
|
|
//Quaternion quaternion = EC_Game.GetGameRun().GetWorld().GetPlayerMan().GetHostPlayer().transform.rotation;
|
|
|
|
|
Vector3[] arrVExt = new Vector3[5] {
|
|
|
|
|
vExt
|
|
|
|
|
,new Vector3(vExt.x / num, vExt.y, vExt.z),
|
|
|
|
|
new Vector3(vExt.x, vExt.y / num, vExt.z),
|
|
|
|
|
new Vector3(vExt.x, vExt.y, vExt.z / num),
|
|
|
|
|
vExt / num
|
|
|
|
|
};
|
|
|
|
|
for (int i = 0; i < arrVExt.Length; i++)
|
|
|
|
|
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
|
|
|
|
|
if (countHits > 0)
|
|
|
|
|
{
|
|
|
|
|
countHits = Physics.BoxCastNonAlloc(vStart, arrVExt[i], dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
|
|
|
|
|
if (countHits > 0)
|
|
|
|
|
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
|
|
|
|
if (check)
|
|
|
|
|
{
|
|
|
|
|
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
|
|
|
|
if (Math.Abs(hits[0].distance - 0f) < float.Epsilon)
|
|
|
|
|
BoxCastDrawer.Draw(vStart, vExt, vDelta.normalized,
|
|
|
|
|
Quaternion.identity, vDelta.magnitude, hits, 1, Color.green, 10f);
|
|
|
|
|
}
|
|
|
|
|
if (check)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("AABBCollideWithBrush pos = " + hits[0].point + " name = " + hits[0].collider.name);
|
|
|
|
|
}
|
|
|
|
|
if (Math.Abs(hits[0].distance - 0f) < float.Epsilon)
|
|
|
|
|
{
|
|
|
|
|
brushTraceInfo.bStartSolid = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
brushTraceInfo.fFraction = (hits[0].distance) / vDelta.magnitude;
|
|
|
|
|
brushTraceInfo.normal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
|
|
|
|
|
hitPoint = hits[0].point;
|
|
|
|
|
if (check)
|
|
|
|
|
{
|
|
|
|
|
brushTraceInfo.bStartSolid = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
brushTraceInfo.fFraction = (hits[0].distance) / vDelta.magnitude;
|
|
|
|
|
brushTraceInfo.normal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
|
|
|
|
|
hitPoint = hits[0].point;
|
|
|
|
|
return true;
|
|
|
|
|
Debug.LogError("AABBCollideWithBrush true pos = " + hits[0].point);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
brushTraceInfo.normal = new A3DVECTOR3(0f);
|
|
|
|
|
brushTraceInfo.fFraction = 100f;
|
|
|
|
|
if (check)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("AABBCollideWithBrush false = ");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1423,9 +1479,11 @@ namespace BrewMonster
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static float DotProduct(A3DVECTOR3 v1, A3DVECTOR3 v2) { return v1.x* v2.x + v1.y* v2.y + v1.z* v2.z;
|
|
|
|
|
static float DotProduct(A3DVECTOR3 v1, A3DVECTOR3 v2) { return v1.x* v2.x + v1.y* v2.y + v1.z* v2.z;}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public struct OtherPlayer_Move_Info
|
|
|
|
|
{
|
|
|
|
|
// Bounding sphere of avator
|
|
|
|
@@ -1489,4 +1547,113 @@ namespace BrewMonster
|
|
|
|
|
// still be satisfied, bMeetHeightThresh is set to true.
|
|
|
|
|
public bool bMeetHeightThresh;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static class BoxCastDrawer
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Vẽ BoxCast để Debug
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="duration">Thời gian tồn tại của đường kẻ (giây). Mặc định là 0 (1 frame)</param>
|
|
|
|
|
public static void Draw(
|
|
|
|
|
Vector3 center,
|
|
|
|
|
Vector3 halfExtents,
|
|
|
|
|
Vector3 direction,
|
|
|
|
|
Quaternion orientation,
|
|
|
|
|
float distance,
|
|
|
|
|
RaycastHit[] hits,
|
|
|
|
|
int hitCount,
|
|
|
|
|
Color color,
|
|
|
|
|
float duration = 0f) // Thêm tham số duration ở đây
|
|
|
|
|
{
|
|
|
|
|
// 1. Tính toán các góc
|
|
|
|
|
Vector3[] startCorners = GetBoxCorners(center, halfExtents, orientation);
|
|
|
|
|
|
|
|
|
|
float drawDistance = distance;
|
|
|
|
|
if (hitCount > 0)
|
|
|
|
|
{
|
|
|
|
|
float minDistance = distance;
|
|
|
|
|
for (int i = 0; i < hitCount; i++)
|
|
|
|
|
{
|
|
|
|
|
if (hits[i].distance < minDistance && hits[i].distance > 0)
|
|
|
|
|
minDistance = hits[i].distance;
|
|
|
|
|
}
|
|
|
|
|
drawDistance = minDistance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vector3 endCenter = center + direction.normalized * drawDistance;
|
|
|
|
|
Vector3[] endCorners = GetBoxCorners(endCenter, halfExtents, orientation);
|
|
|
|
|
|
|
|
|
|
// 2. Thiết lập màu sắc
|
|
|
|
|
//Color color = hitCount > 0 ? Color.red : Color.green;
|
|
|
|
|
//Color sweepColor = new Color(0.5f, 0.5f, 0.5f, 0.5f); // Màu xám mờ
|
|
|
|
|
Color sweepColor = color; // Màu xám mờ
|
|
|
|
|
|
|
|
|
|
// 3. VẼ TÂM (CENTER) - Hiển thị trục tọa độ Local của hộp
|
|
|
|
|
DrawCenterAxis(center, orientation, 0.3f, duration); // Tâm bắt đầu
|
|
|
|
|
DrawCenterAxis(endCenter, orientation, 0.3f, duration); // Tâm kết thúc
|
|
|
|
|
|
|
|
|
|
// 3. Vẽ các đường Line với Duration
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
// Vẽ hộp bắt đầu
|
|
|
|
|
Debug.DrawLine(startCorners[i], startCorners[(i + 1) % 4], color, duration);
|
|
|
|
|
Debug.DrawLine(startCorners[i + 4], startCorners[((i + 1) % 4) + 4], color, duration);
|
|
|
|
|
Debug.DrawLine(startCorners[i], startCorners[i + 4], color, duration);
|
|
|
|
|
|
|
|
|
|
// Vẽ hộp kết thúc/va chạm
|
|
|
|
|
Debug.DrawLine(endCorners[i], endCorners[(i + 1) % 4], color, duration);
|
|
|
|
|
Debug.DrawLine(endCorners[i + 4], endCorners[((i + 1) % 4) + 4], color, duration);
|
|
|
|
|
Debug.DrawLine(endCorners[i], endCorners[i + 4], color, duration);
|
|
|
|
|
|
|
|
|
|
// Vẽ các đường nối (Sweep lines)
|
|
|
|
|
Debug.DrawLine(startCorners[i], endCorners[i], sweepColor, duration);
|
|
|
|
|
Debug.DrawLine(startCorners[i + 4], endCorners[i + 4], sweepColor, duration);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 4. Vẽ chi tiết va chạm
|
|
|
|
|
for (int i = 0; i < hitCount; i++)
|
|
|
|
|
{
|
|
|
|
|
// Vẽ pháp tuyến (Normal) tại điểm chạm
|
|
|
|
|
Debug.DrawRay(hits[i].point, hits[i].normal * 0.5f, Color.yellow, duration);
|
|
|
|
|
// Vẽ một dấu X nhỏ tại điểm va chạm chính xác
|
|
|
|
|
DrawCross(hits[i].point, 0.1f, Color.cyan, duration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void DrawCross(Vector3 point, float size, Color color, float duration)
|
|
|
|
|
{
|
|
|
|
|
Debug.DrawLine(point + Vector3.up * size, point - Vector3.up * size, color, duration);
|
|
|
|
|
Debug.DrawLine(point + Vector3.right * size, point - Vector3.right * size, color, duration);
|
|
|
|
|
Debug.DrawLine(point + Vector3.forward * size, point - Vector3.forward * size, color, duration);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Vector3[] GetBoxCorners(Vector3 center, Vector3 halfExtents, Quaternion orientation)
|
|
|
|
|
{
|
|
|
|
|
Vector3[] corners = new Vector3[8];
|
|
|
|
|
Vector3 h = halfExtents;
|
|
|
|
|
corners[0] = center + orientation * new Vector3(-h.x, -h.y, h.z);
|
|
|
|
|
corners[1] = center + orientation * new Vector3(h.x, -h.y, h.z);
|
|
|
|
|
corners[2] = center + orientation * new Vector3(h.x, h.y, h.z);
|
|
|
|
|
corners[3] = center + orientation * new Vector3(-h.x, h.y, h.z);
|
|
|
|
|
corners[4] = center + orientation * new Vector3(-h.x, -h.y, -h.z);
|
|
|
|
|
corners[5] = center + orientation * new Vector3(h.x, -h.y, -h.z);
|
|
|
|
|
corners[6] = center + orientation * new Vector3(h.x, h.y, -h.z);
|
|
|
|
|
corners[7] = center + orientation * new Vector3(-h.x, h.y, -h.z);
|
|
|
|
|
return corners;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void DrawCenterAxis(Vector3 pos, Quaternion rot, float size, float duration)
|
|
|
|
|
{
|
|
|
|
|
Debug.DrawRay(pos, rot * Vector3.right * size, Color.red, duration);
|
|
|
|
|
Debug.DrawRay(pos, rot * Vector3.up * size, Color.green, duration);
|
|
|
|
|
Debug.DrawRay(pos, rot * Vector3.forward * size, Color.blue, duration);
|
|
|
|
|
|
|
|
|
|
// Vẽ thêm một khối diamond nhỏ màu trắng tại tâm để dễ nhận diện
|
|
|
|
|
float s = size * 0.2f;
|
|
|
|
|
Debug.DrawLine(pos + rot * Vector3.up * s, pos + rot * Vector3.right * s, Color.white, duration);
|
|
|
|
|
Debug.DrawLine(pos + rot * Vector3.right * s, pos - rot * Vector3.up * s, Color.white, duration);
|
|
|
|
|
Debug.DrawLine(pos - rot * Vector3.up * s, pos - rot * Vector3.left * s, Color.white, duration);
|
|
|
|
|
Debug.DrawLine(pos - rot * Vector3.left * s, pos + rot * Vector3.up * s, Color.white, duration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|