# How To Make A Wall Slam Effect After Raycast

I want to make a wall slam effect, similar to this:

But make it so the rocks will appear on the wall.
To make this I use raycasting, the only problem is that I don’t know how to rotate these rocks so they will appear around, for example, a Part that is attached to a wall. Should I use CFrame.fromEulerAnglesXYZ() or is there a better solution?

When you raycast something and it interacts something you get its intersection point and the normal of that surface. So you just need to align the vectors, pretty straightforward

p = intersection + normal * 10
CFrame.new(intersection, p)

and you are done

1 Like

Hard to get rid of old habits, but remember to use CFrame.lookAt() not CFrame.new()

2 Likes

Thank you for the response. I’m a bit confused, how do I get intersection and normal?

do you know how to raycast? intersection = origin + direction normal = raycastResult.Normal

1 Like

Placing rocks works well, but how to rotate them around a certain object along the plane the ray touched?

the cframe thing should do that, if it isnt working try doing -normal or multiply it by 1.01

I get this if I:
local p = (Pos + Normal * 1.01) * 10
I guess this won’t work like I want it to, I’ve seen many people making a ground slam vfx, they used a loop in which they used some formula and just changed the angle once 1 loop is done, and rocks appeared around the character, so I want to do the same, but rotate rocks so they appear around the object attached to a wall.

Here you go lol.

1 Like

Raycast to your point, then use this module to create the effect around the vector, I guess .

1 Like

I still cant make it so the rocks will appear on the wall, around given object, I guess the “Z” axis is the right one here, but I still can’t get the result I want, here’s my code:

local p = Pos + Normal * 10
for i = 1,15 do
Rock.Parent = workspace
Angle += 360/i
end

Do you have any ideas?