in reply to Re: octtree using hashes
in thread octtree using hashes
This is a instantiation of the hash octtree, which has an object in it which is collisioned against at 4000 / (2 * 20):use lib "../../HollyGame"; package Ultima8::WorldObject; sub WorldObject { my ($class, $x, $y, $z, $w, $h, $d) = @_; $self = { x => $x, y => $y, z => $z, w => $w, h => $h, d => $d + }; return bless $self, ref($class) || $class; }
The line :$self->{octtree} = Ultima8::OctTree->OctTree(4000,4000,200,(WorldObjec +t->WorldObject(100,100,100,100,100,100)));
concatenates an world object to the member rootnodes with a key which is a level in subdivision of the space (in 2) You check for 8 collisions which are the intersection of 2 squares, one above the other in an cube subdivision. The methods draw and update I haven't done yet.$self->{rootnodes}{$level} .= $obj;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: octtree using hashes
by Corion (Patriarch) on Nov 09, 2017 at 11:45 UTC | |
by holyghost (Beadle) on Nov 09, 2017 at 12:01 UTC |