fix: update logic move.
This commit is contained in:
@@ -213,7 +213,7 @@ namespace BrewMonster
|
||||
// 注意:暂时跳过地形高度检查,因为它需要世界访问
|
||||
A3DVECTOR3 vNormal = new A3DVECTOR3();
|
||||
float vTerrainHeight = vPos.y;
|
||||
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, 1000f, 1 << 6) > 0)
|
||||
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, maxDistance: 1000f, EC_CDR.TerrainMask) > 0)
|
||||
{
|
||||
vTerrainHeight = hits[0].point.y;
|
||||
vNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
|
||||
|
||||
@@ -1390,9 +1390,9 @@ namespace BrewMonster
|
||||
m_CDRInfo.vExtent = m_aabbServer.Extents;
|
||||
Vector3 pStart = pos;
|
||||
pos.y += m_CDRInfo.vExtent.y;
|
||||
if (Physics.RaycastNonAlloc(pos, Vector3.down, hits, m_CDRInfo.vExtent.y, 1 << 6) > 0)
|
||||
if (Physics.RaycastNonAlloc(pos, Vector3.down, hits, m_CDRInfo.vExtent.y, EC_CDR.TerrainMask) > 0)
|
||||
{
|
||||
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
m_CDRInfo.vTPNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
|
||||
}
|
||||
else
|
||||
@@ -1799,14 +1799,14 @@ namespace BrewMonster
|
||||
float fTerrainHeight = 0f;
|
||||
if (Physics.RaycastNonAlloc(startPoint, dir, hits, layerGround) > 0)
|
||||
{
|
||||
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
fTerrainHeight = Vector3.Distance(hits[0].point, startPoint);
|
||||
}
|
||||
|
||||
float fWaterHeight = 0f;
|
||||
if (Physics.RaycastNonAlloc(startPoint, dir, hits, layerWater) > 0)
|
||||
{
|
||||
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
fWaterHeight = Vector3.Distance(hits[0].point, startPoint);
|
||||
}
|
||||
|
||||
@@ -2459,10 +2459,10 @@ namespace BrewMonster
|
||||
|
||||
A3DVECTOR3 vPos = GetPos();
|
||||
float h0 = 0f;
|
||||
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vPos) + Vector3.up * 500f, Vector3.down, hits, 1000f, 1 << 8);
|
||||
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vPos) + Vector3.up * 500f, Vector3.down, hits, maxDistance: 1000f, EC_CDR.WaterMask);
|
||||
if (countHits0 > 0)
|
||||
{
|
||||
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
h0 = hits[0].point.y;
|
||||
}
|
||||
if (vPos.y < h0 - m_MoveConst.fShoreDepth)
|
||||
@@ -3184,7 +3184,7 @@ namespace BrewMonster
|
||||
VertRayTrace(EC_Utility.ToVector3(vTestPos), ref vGndPos, ref m_GndInfo.vGndNormal, 1000f);
|
||||
m_GndInfo.fGndHei = vGndPos.y;
|
||||
|
||||
if (Physics.RaycastNonAlloc(EC_Utility.ToVector3(vTestPos) + Vector3.up * 500f, Vector3.down, hits, 1000f, 1 << 8) > 0)
|
||||
if (Physics.RaycastNonAlloc(EC_Utility.ToVector3(vTestPos) + Vector3.up * 500f, Vector3.down, hits, maxDistance: 1000f, EC_CDR.WaterMask) > 0)
|
||||
{
|
||||
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
m_GndInfo.fWaterHei = hits[0].point.y;
|
||||
@@ -3286,9 +3286,10 @@ namespace BrewMonster
|
||||
|
||||
LayerMask layerMaskTerrain = 1 << 6;
|
||||
LayerMask layerMaskBush = 1 << 7;
|
||||
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, 1000f, layerMaskTerrain) > 0 /*&& hits[0].distance > 0.0009f*/)
|
||||
|
||||
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, maxDistance: 1000f, layerMaskTerrain) > 0 /*&& hits[0].distance > 0.0009f*/)
|
||||
{
|
||||
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
|
||||
vTerrainPos = hits[0].point;
|
||||
vTerrainNormal = hits[0].normal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user