Hello!
How do I get the yaw of my winspeed? Or, if there is any other way to get from which direction the wind is coming from.
Thanks!
Hello!
How do I get the yaw of my winspeed? Or, if there is any other way to get from which direction the wind is coming from.
Thanks!
Usually you would use Vector3.new(0,0,0) to make a direction, but im not sure how you would get the angles of those directions if you wanted that.
Yeah. I am looking for like a rotation in degrees…
Actually, you could
local winddirection = Vector3.new(10,3,0)
local lookat = CFrame.lookAt(Vector3.new(0,0,0), winddirection, Vector3.new(0,1,0))
local x, y, z= lookat:ToOrientation()
x = math.deg(x)
y = math.deg(y)
z = math.deg(z)
Sorry I was typing this up lol.
You can convert can use the Workspace’s GlobalWind
property to a Vector3 representing the wind’s speed and direction. From its just a matter of converting that vector to an angle which you matches the angle given in the Wind Direction view on Roblox Studio.
-- Get the Vector3 representing the wind
local wind = workspace.GlobalWind
-- Normalize the Vector3 to get the direction
local direction = wind.Unit
-- Convert the vector to its polar angle
local radians = math.atan2(direction.Z, direction.X)
-- Convert to degrees and offset by 180
local yaw = math.deg(radians) + 180
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.