I’ve been working on a car engine. Currently I’m trying to get the car to work on its local axis, and found that CFrame.fromEulerAnglesXYZ might do it.
Whenever I run the function
local newVector = CFrame.new(0, stats.temp.Turn, 0) -- Line 39
print(newVector:fromEulerAnglesXYZ()) -- Line 40
it returns an error
I’ve tried the following code:
local newVector = CFrame.new(0, stats.temp.Turn, 0)
print(newVector:fromEulerAnglesXYZ())
--
local newVector = CFrame.new(0, stats.temp.Turn, 0)
print(newVector.fromEulerAnglesXYZ())
--
local newVector = Vector3.new(0, stats.temp.Turn, 0)
print(newVector:fromEulerAnglesXYZ())
--
local newVector = Vector3.new(0, stats.temp.Turn, 0)
print(newVector.fromEulerAnglesXYZ())
--
local newVector = CFrame.new(0, stats.temp.Turn, 0)
print(newVector.FromEulerAnglesXYZ())
--
local newVector = CFrame.new(0, stats.temp.Turn, 0)
print(newVector:FromEulerAnglesXYZ())
--
local newVector = Vector3.new(0, stats.temp.Turn, 0)
print(newVector.FromEulerAnglesXYZ())
--
local newVector = Vector3.new.new(0, stats.temp.Turn, 0)
print(newVector:FromEulerAnglesXYZ())
--[[I've also tried it with a (0, 0, 0) inside the function too,
although I don't believe that's the problem]]--
Whether I use Vector3, CFrame, caps, no caps, colon, or period, I can’t get the function to work.
Any idea what’s going on?
fromEulerAnglesXYZ is a constructer not a method/(function of a cframe) and i believe it is listed as such on on the CFrame API Reference as well, if you are trying to convert the cframe instead, then you might want to use ToEulerAnglesXYZ (which returns 3 values btw)
you cant use fromEulerAnglesXYZ to get EulerAnglesXYZ from a CFrame as it is used to make a cframe (a constructer) , try using ToEulerAnglesXYZ () instead, which returns 3 values giving you back EulerAngles in the XYZ order (in radians) .
fromEulerAnglesXYZ is used like:
local NewCFrame = CFrame.fromEulerAnglesXYZ(rx, ry,rz)
fromEulerAnglesXYZ is a constructor, as stated previously. This means you do not call it on a CFrame object, but rather on the CFrame datatype. You seem to be calling it on a CFrame object, which would obviously throw an error.