I am trying to make it so that when looking around a wall like in the video shown below, it doesnt let you just shoot the opposite side of the wall or straight up pass through/ignore the wall, it would make this EXTREMELY annoying to deal for players, so i want to know if there is a way to prevent it?
video:
What’s the origin of your raycast? It seems like you set it to the camera’s position, which is why it looks like it is passing through walls. Try setting the origin to the front of your gun’s position instead, which should fix the issue.
The raycasts origin is at the barrel of the gun, but its ignoring walls and going through to where you clicked, i need it to detect walls and stop at the wall if it hits one on the way to the mouse’s position
May you please send your code of the raycasting? Raycasts should stop immediatly when it hits an object.
nevermind! i have found the issue, it is not doing damage through walls, it is only the bullet hole doing so, ill mark this as the solution if im able to fix it, if not i will make another reply
the solution wash switching the bulletholes position from the mouse, to the raycast result position
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.