Shooting a Raycast Based on Wind Direction (in CFrame.Angles)

I need to shoot a raycast based off a Vector3 position in the direction of a CFrame.Angles rotation thingy. (this is based off the wind direction converted into cframe.angles)

local wind = workspace.GlobalWind
local windRotation = CFrame.Angles(
	math.rad(wind.X),
	math.rad(wind.Y), 
	math.rad(wind.Z)
)
return windRotation

Above is the code to get the wind direction and give it back as CFrame.Angles.

Whenever I try to shoot the raycast it returns as nil when I think it should be shooting regularly.

I use the lookvector of the CFrame to shoot the raycast which gives me this:

0.4067366421222687, -0.09138357639312744, -0.9089633226394653

To shoot the raycast I make the CFrame for the position of the part (start point) to a Vector3. Then I use the LookVector of the CFrame.Angles to get the direction of the raycast? Iā€™m not sure if I am at all doing this right.

local rayCastResult = workspace:Raycast(positioning.compileToVector(rainStart), direction.LookVector)

Thank you if you can help.

(all this really needs to do is shoot a raycast from a point in the sky at x direction which my peanut brain can not figure out)

1 Like

Fixed it myself:

local rayCastResult = workspace:Raycast(positioning.compileToVector(rainStart), direction.UpVector * -1000)

i needed to use the upvector because it was getting what was in front of it instead of below it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.