I have a problem with raycast when shooting. When a player is standing on the ground and shooting, the raycast works correctly. But when I shoot from top to bottom, for example in a jump, the raycast often does not work. Tell me, please, how can I solve the problem?
I’ve had a look at it and reduced the issue somewhat by swapping the values of ray from and to (still you don’t fire a ray from inside the box).
However, the issue is still happening and I can’t work out why. I’ve slowed down the bullet and created a ‘ray’ so I can see the travel path of the bullet and it looks like it just goes through the box.
This caught my attention because of the raycast issue I had with the camera having been scaled. This camera is not scaled though. But it is parented to a player object that is scaled on all three axes to 0.5, 0.5, 0.5. Is it possible that scaling the camera to 2, 2, 2 would compensate and fix? Just a thought. Probably not right, but simple to check to see if it matters.
@yaustar, I think I solved the problem. I switched places the variables from and to for raycasting, and seems it all worked. Need to make a large number of shots to understand whether my decision is true. And it seems to me that the boxes began to fly otherwise.