开发者

Detecting which side touched in openGLES 3dbox in iphone

开发者 https://www.devze.com 2023-03-06 06:19 出处:网络
i am working on a project that contains a 3d box that rotated by user touch and opens revelant page when clicked on a side. each side has link to another view so i need to know which side is clicked o

i am working on a project that contains a 3d box that rotated by user touch and opens revelant page when clicked on a side. each side has link to another view so i need to know which side is clicked on the program.

i am using Brad Larson's wonderfull example in my app and i can rotate the cube with touch, thanx to his code and time.

( the code is linked in here: Where to start openGL ES to create and rotate a cube in an iPhone? )

now i need to know how to 开发者_高级运维detect whick side is clicked on the box. normally i develop view based applications, i really have no idea on openGL or things like that.

i've searched the site but couldnt find a good answer (at least something that i can understand with my opengl knowledge)

P.S: Here, the 3dCube code from Brad Larson: http://www.sunsetlakesoftware.com/sites/default/files/CubeExample.zip


Take a look here: http://www.3dkingdoms.com/selection.html

In the OpenGL world, I think they refer to this as "picking". The utility function gluunproject will help you. Intersecting the picking ray with your model's faces should not be hard for a cube.

0

精彩评论

暂无评论...
验证码 换一张
取 消