I’m Raycasting from a part that rotates in a random direction to give off a more random feel.
The Raycast is used to grab a position and use it as an end point for a lightning module.
For some reason, “ray” returns as nil.
The “lightningpart” is in an enclosed area with no way for a ray fired from it to technically escape.
There isn’t much else to say, here is the source code:
local raycastparams = RaycastParams.new()
raycastparams.FilterType = Enum.RaycastFilterType.Exclude
raycastparams.FilterDescendantsInstances = {coreFile.core}
raycastparams.IgnoreWater = true
coreFile.core.lightningpart.Orientation = Vector3.new(math.random(-360,360),math.random(-360,360),math.random(-360,360))
local ray = workspace:Raycast(coreFile.core.lightningpart.Position, coreFile.core.lightningpart.CFrame.LookVector,raycastparams)
coreFile is a folder containing a Part with a different Part (lightningpart) parented to said Part.
Both have the same position.
Any help is appreciated.
Best, xarciti
1 Like
Ovibion
(Alexan)
#2
Have you tried multiplying the direction
argument on the last line?
Didn’t seem to work. Any other things that might have caused issues?
Ovibion
(Alexan)
#4
Have you tested multiple values?
Your other objects may be too far away to be detected if the direction is multiplied by a small number.
I don’t see anything wrong with the RaycastParams
. You can create a part to visualize where the ray is being cast.
The ray returns as nil, makes visualizing a bit hard.
try changing the FilterType to Enum.RaycastFilterType.Blacklist
Blacklist was deprecated recently.
Boosting
More info:
The part the ray is being fired from is around 50-900 studs away from everything around it.
Solved. Turns out it was an issue with my lightning module.
Gave Alex the solution because I probably would have not solved the original issue without the knowledge of that multiplier
system
(system)
Closed
#10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.