(I am not a very good scripter, or, well I don’t think I am, I do know math (doing Higher in school right now, just covered vectors) but please bare with me)
Hi, I’m working on a rain system (based off of the code made by Ethanthegrand14 (ofc with the improvements from dthecoolest and PsyephDEV). I’m stuck with the splash-parts like so:
(sorry for the poor visibility of the part on the wedge, I’ve outlined it so you can see it)
As you can see, the splash-parts are slightly floating above the parts. I’ve tried to fix this but to no avail. I think it could be something to do with the code for aligning the vectors of the parts:
where result_normal is the normal vector returned by raycasting,
result_position is the position returned by raycasting,
splash_clone is a clone of the splash_part template
local right_vector = Vector3.new(0, 1, 0):Cross(result_normal)
if right_vector.Magnitude == 0 then
right_vector = result_position.Unit:Cross(result_normal)
end
task.synchronize()
splash_clone.CFrame = CFrame.new(result_position) * CFrame.fromMatrix(result_normal, right_vector, result_normal)
Also, on flat surfaces, the splash-parts rotate on the x-axis randomly. Any idea why?
Thanks