I have a quadtree with points.
Can't do two things:
- I want the dots not to go through each other. For example, if two dots cross each other, they must as if push back.
- I have a small rectangle and I want the dots not to go through its walls.
How do you do it in the quickest way?
I work with the quad tree like this (little pseudocode), every time I re-create it and draw (and insert dots)
function quad_init() {
for (p in Points) {
// move the dots a little bit to create the illusion of movement
p.randomv_move();
// Collision detection here????
tree.insert(p);
}
}
function game_loop() {
each tick call function quad_init();
}
Please login or Register to submit your answer