Archived
Emergency backup
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR;
|
||||
|
||||
using XericLibrary.Runtime.Type;
|
||||
|
||||
namespace XericLibrary.Runtime.CollisionLOD
|
||||
{
|
||||
/// <summary>
|
||||
/// 盒体的AABB碰撞器
|
||||
/// </summary>
|
||||
public class LodBoxCollider : LodColliderBase
|
||||
{
|
||||
#region 字段属性
|
||||
|
||||
/// <summary>
|
||||
/// 启用轴向
|
||||
/// </summary>
|
||||
public Bool3 EnableCollisionAxis = new Bool3(1,0,1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 生命周期
|
||||
@@ -25,9 +24,38 @@ namespace XericLibrary.Runtime.CollisionLOD
|
||||
|
||||
#region 碰撞检测
|
||||
|
||||
private bool CheckCollision()
|
||||
private static bool CheckCollision(LodBoxCollider box1, LodBoxCollider box2)
|
||||
{
|
||||
return false;
|
||||
var box1max = box1.BoundSize.max;
|
||||
var box1min = box1.BoundSize.min;
|
||||
var box2max = box2.BoundSize.max;
|
||||
var box2min = box2.BoundSize.min;
|
||||
|
||||
bool collidX = box1max.x >= box2min.x
|
||||
&& box2max.x >= box1min.x;
|
||||
bool collidY = box1max.y >= box2min.y
|
||||
&& box2max.y >= box1min.y;
|
||||
bool collidZ = box1max.z >= box2min.z
|
||||
&& box2max.z >= box1min.z;
|
||||
|
||||
bool enableCollidX = box1.EnableCollisionAxis.x
|
||||
&& box2.EnableCollisionAxis.x;
|
||||
bool enableCollidY = box1.EnableCollisionAxis.y
|
||||
&& box2.EnableCollisionAxis.y;
|
||||
bool enableCollidZ = box1.EnableCollisionAxis.z
|
||||
&& box2.EnableCollisionAxis.z;
|
||||
|
||||
if(!(enableCollidX && enableCollidY && enableCollidZ))
|
||||
return false;
|
||||
|
||||
bool rescollidX = enableCollidX && collidX
|
||||
|| (!enableCollidX && (collidY || collidZ));
|
||||
bool rescollidY = enableCollidY && collidY
|
||||
|| (!enableCollidY && (collidX || collidZ));
|
||||
bool rescollidZ = enableCollidZ && collidZ
|
||||
|| (!enableCollidZ && (collidX || collidY));
|
||||
|
||||
return rescollidX && rescollidY && rescollidZ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user