Indeed, I needed the push operator to push a world object onto the key $level of the hash of levels. My system is not a general octtree but using octants which have world objects contained on their crossings. My level 0 in the hash of $self->{rootnodes} is the topmost octant. if there are any world objects in it such as a non-player character it has to switch octants for which walking around just diminishes the $self->{rootnodes}{$level} then should put it in a larger octant and so on. Now when you are walking around a low level (so bigger octants) you can turn off collision detection by measuring the corners contained in the rootnodes hash. This calculation can be done in a thread e.g. on a sorted list of world objects walking around in octants. The fact is if you are on a level within the rootnodes hash it might be that there are no objects within that octant as the values array of the $level key is empty, and so the thread can work further on. My octant subdivisor now goes to pixel level, it stops at e.g. $middlex <= 1, you can also stop at the intersection multiplicity where you cross a world object contained in 9 upper level cubes.

In reply to Re^4: octtree using hashes by holyghost
in thread octtree using hashes by holyghost

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.