im starting to see it … Here we go. Didn’t take math class for nothin’
I can’t really tell if that is really the case right now but if this is true, randomly choose between +1 and -1 and multiply it to the z value.
Add me on Dizzy. You could most definitely help me in the future. (Also you can watch my events if you’d like) DomderpRBLX#0455
Your solution also only accounts for positive X and Y, which would result in a semihemisphere AFTER the negated Z change. X and Y should be a random number between -5 and 5, not 0 and 5.
How could I tween it so the Z value goes out? Giving it an explosion effect…?
You would need to tween its position from the center position to the target position (the one generated from my code snippet or likewise).
Give me an example. Also add me on dizzy : DomderpRBLX#0455
I’n on my phone so it’ll take a while. Give me a few minutes to write up an example.
Mhm, I was oversimplifying there and couldn’t tell that until I got to using a pen and paper. Turns out I just forgot to consider the other case: y^2 < 5^2-x^2 gives you -sqrt(5^2-x^2)<y< sqrt(5^2-x^2).
Fixed my answer to include both.
Edit: Oh wait, nvm, you will have to do a separate random picker for either -1 or 1. My bad!
Tried to make it as easy to read and edit as possible
--Services
local TweenService = game:GetService("TweenService");
--Variables
local TWEEN_INFO_BOOM = TweenInfo.new(5);
local CENTER_POSITION = Vector3.new(); --Your center position here
local FINAL_RADIUS = 50; --Your radius here
local PARTICLE_COUNT = 200; --Your desired particle count here
local REFERENCE_PARTICLE = game.ServerStorage.Particle; --Your particle here
for _=1,PARTICLE_COUNT do
local unitDirection = Vector3.new(math.random()-.5,math.random()-.5,math.random()-.5).Unit; --This is a random directional vector with magnitude 1
local startCFrame = CFrame.new(CENTER_POSITION,CENTER_POSITION+unitDirection); --Starts at center and points outwards
local endCFrame = startCFrame+unitDirection*FINAL_RADIUS; --Ends a certain distance away from the center based on the direction, still pointing the same way
local clone = REFERENCE_PARTICLE:Clone(); --Our clone :)
clone.CFrame = startCFrame;
clone.Parent = workspace; --Just setting up the clone
TweenService:Create(clone,TWEEN_INFO_BOOM,{CFrame=endCFrame}):Play(); --Animate! >:)
end
Try multiplying the numbers and also, you don’t need to put my code inside your for loop you can just use my code but you would have to create the parts inside the loop i gave you
also here is a gif on how cosine an sine works