diff options
author | chai <215380520@qq.com> | 2023-05-10 18:09:12 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-05-10 18:09:12 +0800 |
commit | 530881df3968089a8b07e0f9b79185b844d0cdd0 (patch) | |
tree | 6f61565923012e7e8e0c610a10928a5d39230201 /marching/Assets/Scripts/Physics/Quadtree.cs | |
parent | caeba98e0385edebb344e6dbd024c01801a75fc4 (diff) |
* raycast
Diffstat (limited to 'marching/Assets/Scripts/Physics/Quadtree.cs')
-rw-r--r-- | marching/Assets/Scripts/Physics/Quadtree.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/marching/Assets/Scripts/Physics/Quadtree.cs b/marching/Assets/Scripts/Physics/Quadtree.cs index 9f8ecba..a012d26 100644 --- a/marching/Assets/Scripts/Physics/Quadtree.cs +++ b/marching/Assets/Scripts/Physics/Quadtree.cs @@ -29,7 +29,7 @@ namespace mh private int m_Level; private Vector4 m_Bounds; // x,y,z,w => posx,posy,width,height private Quadtree[] m_SubTrees; // 从右上角开始逆时针索引 - private List<IQuadTreeObject> m_Objects; // 当前层能容纳,但任何一个子树都无法容纳的对象 + private List<IQuadTreeObject> m_Objects; // 非叶节点的为0 private bool m_IsRoot; public Vector4 bound { get { return m_Bounds; } } @@ -47,7 +47,6 @@ namespace mh public bool isRoot { get { return m_IsRoot; } } private static Queue<List<IQuadTreeObject>> m_QuadtreeObjPool = new Queue<List<IQuadTreeObject>>(); - private static Queue<Quadtree> m_QuadtreePool = new Queue<Quadtree>(); private Quadtree QueryQuadtree(int level, Vector4 bounds) @@ -97,8 +96,17 @@ namespace mh m_IsRoot = isRoot; } + /// <summary> + /// 更改边界,只适用于最外层的tree + /// </summary> + /// <param name="bounds"></param> public void Rebound(Vector4 bounds) { + if(!m_IsRoot) + { + Debug.LogError("Quadtree.Rebound()只能运用于最外层"); + return; + } m_Bounds = bounds; } |