Skip to content

some question #1

Open
Open
@GITHUB243884919

Description

@GITHUB243884919

hi ~ Think you and thank your code. I am learning quadtree. I have some questions.

  1. In the DemoScript.Update()
    `
    // refresh QuadTree each frame if bodies can move

     _quadTree.Clear();
    
     foreach(var b in _quadTreeBodies)
    
     {
    
         _quadTree.AddBody(b);
    
     }
    

`
I understand that there is rebuild QuadTree in per frame. I know do it because bodies is moving in per frame. I think maybe there is a way that deal it without rebuild QuadTree. But I do not know. So I ask you.

2 . In the QuadTree's 2nd Constructors function
`
private QuadTree(Rect bounds, QuadTree parent)

        : this(bounds, parent._maxBodiesPerNode, parent._maxLevel)
    {
        _parent = parent;

        _curLevel = parent._curLevel + 1;

    }

`
why _maxLevel is parent._maxLevel? I think _maxLevel = parent._maxLevel - 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions