有没有射线方法判断点击到哪个模型之类的 或者有没有点击事件可以触发的?
demo里没找到
creator3d
有没有射线方法判断点击到哪个模型之类的 或者有没有点击事件可以触发的?
demo里没找到
creator3d
demo 稍后会有,你可以用这种方式获取,
start () {
systemEvent.on(SystemEventType.TOUCH_START, this._touchStart, this);
}
_touchStart(touch: Touch, event: EventTouch){
const ray = new geometry.ray();
const camera = this.getComponent(CameraComponent);
const pos = touch.getLocation();
camera.screenPointToRay(pos.x, pos.y, ray);
const result = this.node.scene.renderScene.raycast(ray);
}
ok~感谢感谢
就差这么个方法 我去试下
这个方法目前性能损耗比较高,是逐面片检测,后续版本会支持基于 Collider 的射线检测
好的~~感谢 后面我再换新的方法
新方法出来了吗?
1.0.1 可以用,看发布帖
1.0.1 什么时候发布呀
我正在使用此方法,检测触摸或者使用鼠标点击。但是on方法并不允许我第一个参数设置为SystemEventType.TOUCH_START, 但是off是没有编译提示的, --VSCode
详细代码为 systemEvent.on(SystemEventType.TOUCH_START, this.onClick, this)
onClick(touch : Touch, event : EventTouch) : void -ts code
3.8版中 this.node.scene.renderScene中没有raycast这个方法,是被替换了吗?还是新方法出来了?