How do I make wallbanging(With Raycasting)?

  1. What do you want to achieve? Keep it simple and clear!
    I would like to make a wallbanging script that works well for my fps game.
  2. What is the issue? Include screenshots / videos if possible!
    I can’t think of how I would make wallbanging.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried making it but I can’t really think of how to do it so please help.

Any help is appreciated.

I can’t write an exact script, but you could check if a wall is thin enough then make the bullet phase through the wall.

I don’t really need a script, I kind of need a drawing or representation of some sort

I don’t exactly know what you mean, but here you go.

Wallbanging is when bullets penetrate a wall via hitting a weak point, but to keep it simple we’re going to be simulating weak points by thickness and material (if your game uses the built-in Roblox materials).


If a bullet collided with a brick wall this thick:


It would definitely not penetrate it, on the other hand if a bullet collides with a wood wall with the same thickness as this ruler:

It would definitely penetrate it.

something like the image @orange451 Bullet Wallbanging is not functioning properly - #8 by orange451
posted, since i don’t really understand how he did it

This image represent the principle pretty good. It’s just ray that comes out of gun in direction where mouse is positing, if it hits object then another ray is casted, coming out of end position of first ray (actually it’s not end position, just end of rendering for ray) to a starting position, basically inversed ray and ray should hit the same object, but from opposite side. So if we going to count distance between these two hits and it’s going to be smaller then max thickness for wallbang then we cast third ray with exception of object that was hit by first two rays and “bullet” pass through it.

1 Like

wall
:grinning: :ok_hand: