Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1050575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:47:26+00:00 2026-05-16T16:47:26+00:00

Here is my issue. I’m rendering axis alligned cubes that are all the same

  • 0

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**
******
******

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.

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 < 135; ++i)
{
 for(int j = 0; j < 50; ++j)
 {
  for(int k = 0; k < 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));
   }
  }
 }
}

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.

Thanks

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

instead of rendering the above id like it to only, ex if the player is facing ->

...... ****
...... ****
......P****
...... ****
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:47:26+00:00Added an answer on May 16, 2026 at 4:47 pm

    After looking at your code again, maybe this is your problem:

    PlayerPosition.x += 70.0f * float(sin(yrotrad));
    PlayerPosition.y -= 20;
    PlayerPosition.z += 70.0f * -(float(cos(yrotrad)));
    

    and what types are the coordinates?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My issue here is that i want to populate all the records except latest
Having an issue here that I have tried everything I can think of but
I'm having an issue here, I am trying to get all the titles from
I'm running a weird issue here. I have code that makes jquery ajax calls
I have created fiddle here: http://jsfiddle.net/ozzy/WEGMh/ How it should look is here: Issue is
The issue here is a bit abstract. We all know, for a background thread
I recreated my issue here . The problem is that the 'left' div should
The issue here is I can see that the data is being written out
Okay so here my issue, I have a list of items that when a
I'm having an issue here that is blowing my mind. It's a very simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.