How RayCast Function works? //Technique-wise

How RayCast Function works? //Technique-wise
0

#1

Hi,

In my game I create raycast function (thanks for same tutorial :wink: ).
I have lots of physics body created by PhysicsEditor. I dont know why but this raycast function not always detect collision with some PhysicsBody.

It is some bug by cocos2d-x developer’s side? Or maybe I made something wrong? Or RayCast function isnt perfect and dont always detect collision and it’s normal :wink:

Have you got same info about it?


#2

Hi,
I got same issue like you got.
I found that if the sprite is scaled by number different 1, raycast function will not detect collision with its physics body.
I dont know how to fix it.


#3

Can you use the debug borders and see if the shape/body are smaller than the scale of the sprite?


#4

I’ve enabled debug mode, and the shape is fit with scaled sprite.

I’ve tried on latest version of cocos2dx 3.13.1. This issue is not happened. The version I got problem is 3.2 and 3.5.

Maybe, developers of Cocos2dx fixed in latest version.

Thanks,