-
I have tried to set up a raycast hit system for my game and have added some static bodies/colliders but even when I directly face one of them, it still does not hit. I have debugged and looked up the data of the colliders/static bodies and it looks fine but it still does not work for some reason...
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The direction of a ray cast also indicates its length. You seem to be testing a 1 unit long raycast against a sphere, so it's likely that the ray is not long enough. Alternatively you can set the mFraction of RayCastResult to something bigger than 1 to allow detecting hits beyond the distance of 'mDirection'. |
Beta Was this translation helpful? Give feedback.
-
Also you are casting a ray against a sphere which by definition is centered around the origin and will never return a body id. You should be casting using NarrowPhaseQuery. |
Beta Was this translation helpful? Give feedback.
Also you are casting a ray against a sphere which by definition is centered around the origin and will never return a body id. You should be casting using NarrowPhaseQuery.