Jump to content
  • Advertisement
Sign in to follow this  
BytePtr

Finding bounds of a square on the cube or something like that

This topic is 2208 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello.
I found interesting method about detecting on which side of cube user clicked:
http://stackoverflow.com/a/5655442

But i don't understand it fully.
Also i don't get it, to which corner (?) for example (100,0,0) or (0,0,100) belongs.

If somebody understands it, what he said or how are the bounds calculated, then please explain.
I have same cube size 1x1x1. But im in OpenGL, not XNA, if that matters.

I would like to try out this but i don't understand it.

A pic would help also.

Thanks in advance. Edited by BytePtr

Share this post


Link to post
Share on other sites
Advertisement
OK as usually after posting topic, i got this to work but not fully.

Because for each cube the X,Y,Z coords change, i need to somehow calculate the bounds using also the X,Y,Z coords. Relative to to block coords or something, but i don't know the math behind it.

If for example: X=4, Y=3, Z=6, how i should calculate bounds for it?
Block size is 1x1x1 (100x100x100) pixels always.

For X0,Y0,Z0 i got really bounds like: 0-1 (float values from gluUnproject, without casting them to int's). But for coords like X1, Y1, Z1 it will no longer work.

Should i multiply X,Y,Z with 1 or something? Or subtract something? I just don't know.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!