Fastcast ricochet (bouncing off wall) not working

i think its something to do with fastcast itself
but im trying to make a ricochet when the bullet bounces off when it hits something
im using the exact same code as the official demo gun tool and it works completely fine

but now i move it to here (with the only difference being the fastcast is handled on the client) it doesnt work at all

External Media

it should look like this

instead it just keeps going through the wall
as you can see in the picture and video the ricochets clearly work but it doesnt work on the second one

function reflect(n1, n2)
	return n2 - (2 * n2:Dot(n1) * n1)

if piercedEvent == "ricochet" then
	local newNormal = reflect(normal, velocity.Unit)
	--velocity /= 1.2
	cast:SetVelocity(newNormal * velocity.Magnitude)

    -- ignore below its just rendering stuff
	data.LastOrigin = point

this code is ran once the canPierce function returns true

again this works all the time in the gun demo with the exact same code (and exact same speed of the bullet, exact same width of the walls, exact same properties on the walls)

fixed through messing with the fastcast source code

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.