Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some question #1

Open
GITHUB243884919 opened this issue Mar 9, 2019 · 0 comments
Open

some question #1

GITHUB243884919 opened this issue Mar 9, 2019 · 0 comments

Comments

@GITHUB243884919
Copy link

GITHUB243884919 commented Mar 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant