How could i make a raycast randomly shoot up from the part with a max angle, that also keeps the rotation of the part of mind.
I’ve made a image for better explanation:
Thanks for reading and please help!
How could i make a raycast randomly shoot up from the part with a max angle, that also keeps the rotation of the part of mind.
I’ve made a image for better explanation:
is it like Up but a bit more towards front or back?
or is it like up and is within a cone?
Mostly upwards like a cone.
charactercharacter
local v = part.CFrame *
CFrame.fromEulerAngles(
math.rad(math.random() * maxConeAngle),
math.random() * 2 * math.pi,
0) * Vector3.YAxis
I get error:
invalid argument #2 (Vector3 expected, got nil)
From line:
cuz he’s multiplying a vector to a number but check if mine would work:
local part
local castRange = 5
local direction = part.UpVector + Vector3.new(Random.new():NextNumber(-1, 1), 0, 0) * castRange
It’s just going up. I want it to randomly shoot up in a sort of cone.
It isn’t even shooting up its going to the side.
probably cuz I forgot to add the .CFrame in part.UpVector
local part
local min = -5
local max = 5
local castRange = 5
local direction = part.CFrame:ToWorldSpace(Vector3.yAxis).Unit + Vector3.new(Random.new():NextNumber(min, max), 0, Random.new():NextNumber(min, max)) * castRange
can’t test if this works cuz I’m in school and not on studio