射线检测


从下面的圆形精灵发出射线,当射线长度为1000时有结果,但测试射线长度100、500都没有结果。

        let direction = v2(this.player_pos.x - pos.x, this.player_pos.y - pos.y)

        direction = direction.normalize()
        let direction2= direction.multiplyScalar(1000)
        console.log(direction2);

        let result = PhysicsSystem2D.instance.raycast(v2(pos.x, pos.y), direction2, ERaycast2DType.All)

这个bug 是我代码写错了,回答错地方

这算什么回答?

还是考虑考虑转Unity吧

Cocos技术还是不成熟

对UI射线检测,官方有出demo,在test-cases-d-v3.5的rayCast

可能跟你的需求不一样

这个demo在哪里,test-cases-d-v3.5在哪里

https://github.com/cocos/cocos-test-projects,就在官方的仓库里