• Create Account

Banner advertising on our site currently available from just \$5!

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

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1BytePtr  Members   -  Reputation: 106

Like
0Likes
Like

Posted 01 August 2012 - 04:18 PM

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.

Edited by BytePtr, 01 August 2012 - 04:19 PM.

### #2BytePtr  Members   -  Reputation: 106

Like
0Likes
Like

Posted 02 August 2012 - 02:30 AM

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.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS