确定 SCNBox 的哪一侧被触摸,Scene Kit ios [英] Determine which side of SCNBox got touched, Scene Kit ios

查看:36
本文介绍了确定 SCNBox 的哪一侧被触摸,Scene Kit ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Scene Kit 并创建了一个 SCNBox.在盒子的正面我想要它,所以如果点击正面的左侧会发生A",如果点击正面的右侧会发生B".我怎样才能做到这一点.我检查了堆栈,但大多数答案涵盖了是否触及节点,而不是节点的一部分.

I am using Scene Kit and have created an SCNBox. On the front face of the box I want it so "A" happens if the left side of the front face gets clicked, and "B" happens if the right side of the front face gets clicked. How can I achieve this. I checked on stack but most answers cover if a node gets touched, not part of a node.

推荐答案

SCNHitTestResult 有一个 geometryIndex 这会给你被击中的几何元素的索引(即立方体面).它还有一个 faceIndex 属性,它将给你这个元素中原语的索引.

SCNHitTestResult has a geometryIndex that will give you the index of the geometry element that was hit (i.e. the cube face). It also has a faceIndex property that will give you the index of the primitive in this element.

这篇关于确定 SCNBox 的哪一侧被触摸,Scene Kit ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆