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

Started by
0 comments, last by BytePtr 11 years, 8 months ago
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.
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.

This topic is closed to new replies.

Advertisement