hi, so basically i’m making an explosion system and the premise is that i want to be able to designate a position and some other settings, but a problem i’m having is making the explosion “fragments” or “shrapnel”. i want them to shoot out at random angles, but i don’t know how to get the cframes for those random angles, (every direction, up, down, left, right, forward, back).
i’m not using velocity, i’m worried about how to get the directions. and i know how math.random works. thanks for the reply but it’s not what i’m asking about.
Well, you can just generate a random direction. Then you can take the origin of the explosion and add the direction onto it, with a CFrame.lookat. Then you can just move the shrapnel in the forward direction.
local dir = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100)).Unit
local shrapnelCFrame = CFrame.lookat(originPosition, originPosition+dir)
for i = 1,100 do
wait(.04)
shrapnelCFrame *= Cframe.new(0,0,-.1)
end
i was already told once you don’t need to be rude about it. i wasn’t acting selfishly, i originally gave exercitus the suggestion because it was the one that i used, but i knew both would’ve probably worked, so i gave it to a comment that had both mentions. its not like i get money for getting a solution