We are using pc.app.systems.rigidbody.raycastFirst() to retrieve the entity details for which collision component is added. It is working fine in web mode but in immersive mode , it is not detecting the collision entities always returing null. We have used the below code to get the raycast result
Thanks for the reply.
Do you have any suggestions that what can we pass to raycastFirst in case VR mode. So far we are passing as like below pc.app.systems.rigidbody.raycastFirst(this.inputSource.getOrigin(), this.inputSource.getDirection());
But as we understood we need to pass end point instead of direction , Can you suggest us what can we pass because as we checked that XRInputSource’s ray contains origin and direction , So we can’t identify what exactly we can pass in case of VR mode.
You will need to project an end point based on the origin and the direction.
ie:
// Project the end point 10 units in the direction of the inputSource
var endPoint = this.inputSource.getDirection().clone().scale(10);
endPoint.add(this.inputSource.getOrigin());