Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with this issue
    text
    copied!<p>Here is my issue. I'm rendering axis alligned cubes that are all the same size. I created an algorithm that rendered around the player like this:</p> <pre><code>****** ****** ***p** ****** ****** </code></pre> <p>While this does work, the player does not see this whole radius. I know the player's rotation angle on the Y, so I was hoping to modify my algorithm based on this so that it would only render about, what the player can see more or less.</p> <pre><code>SetPlayerPosition(); float yrotrad; yrotrad = (Camera.roty / 180 * 3.141592654f); PlayerPosition.x += 70 * float(sin(yrotrad)); PlayerPosition.y -= 20; PlayerPosition.z += 70 * -(float(cos(yrotrad))); collids.clear(); for(int i = 0; i &lt; 135; ++i) { for(int j = 0; j &lt; 50; ++j) { for(int k = 0; k &lt; 135; ++k) { if(!CubeIsEmpty(PlayerPosition.x + i, PlayerPosition.y + j, PlayerPosition.z + k)) { collids.push_back(GetCube(PlayerPosition.x + i, PlayerPosition.y + j, PlayerPosition.z + k)); } } } } </code></pre> <p>Basically, my original algorithm would just subtract 70 from the players location, and render the square that is 70 in size. So I tried to multiply these by the sin and cos os the Y rotation but it did not work. I'm sure this is possible, I just think i'm missing something. How could I achieve my goal of only rendering ~what the player sees.</p> <p>Thanks</p> <p>Just as a note, I tried frustrum culling and this got too slow, I'd rather this which works no matter how many cubes I have</p> <p>instead of rendering the above id like it to only, ex if the player is facing -></p> <pre><code>...... **** ...... **** ......P**** ...... **** </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload