
Sorry I can’t show more of an image, but the project is currently under wraps. I have a very strange issue that seemingly shows Physics.RayCast not working (it sometimes reports a hit when it clearly isnt, and sometimes not when it clearly is) and just wondered if anyone knew anything obvious with the limited info I can give.
The basic code is :-
bool hit =
Physics.Raycast(_rayStartPoint, _rayDirection, out rh, _rayScanRange, layerMask, QueryTriggerInteraction.Ignore);
and the Green debug line is drawn with
Debug.DrawRay(_rayStartPoint, _rayDirection*5, Color.green,2,false);
The red line (cross) is drawn at the point Unity thinks the collision happens (rh.point).
However… the object it reports is being hit, is that green capsule collider you can see. (which clearly isn’t being hit by the line)
The capsule collider is nested in a few game objects, that ultimately move up and down a little, though no strange scale offsets are happening.
If there is anything obvious in physics settings etc that people can suggest, much appreciated. Other wise it currently looks like a Unity bug? I get the issue in both 2017.1 and 2017.3 (both Windows)