开发者

Getting nearest focused object in opengl

开发者 https://www.devze.com 2023-04-11 17:11 出处:网络
I\'m making a minecraft-inspired game through Java LWJGL, which is heavy into development already. However, I am not quite sure what method I would use to pick/highlight the nearest block in t开发者_运

I'm making a minecraft-inspired game through Java LWJGL, which is heavy into development already. However, I am not quite sure what method I would use to pick/highlight the nearest block in t开发者_运维百科he exact center of the player's view frustum.

I am already storing frustum and positional data, which I could use.

I had a vague idea about using raycasting, but this seems to be unrelated based on what people have done with raycasting.

So which function or test would I use to determine this?


Raycasting will definitively work. You need to create a ray from the orientation of your camera and its position.

If your camera rotation matrix has no scale, the axis is the third column ( the z-axis ). Now depending on your convention, z axis may point to screen or to the world

0

精彩评论

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

关注公众号