fromEulerAnglesXYZ is not a valid member of CFrame

  1. 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.

  2. 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
image

  1. 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?

1 Like

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)

local rx, ry,rz =  newVector:ToEulerAnglesXYZ ()
1 Like

That’s why I tried both CFrame.fromEulerAngles and CFrame:fromEulerAngles. Neither seem to be working.

I’ve never used either of these functions before, and therefore not exactly sure how they work… I’ll still check it out though.

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)

Hopefully that makes a bit more sense.

1 Like

I managed to stop it from causing errors, but the car still won’t turn

local chassis = car.Structure.Chassis
local angle = chassis.BodyAngularVelocity
local newVector = CFrame.new(0, stats.temp.Turn, 0)
local rx, ry, rz = newVector.toEulerAnglesXYZ(CFrame.new(0, 0, 0))
angle.AngularVelocity = chassis.CFrame:VectorToWorldSpace(Vector3.new(rx, ry, rz))

I havent tested anything but try this:

local chassis = car.Structure.Chassis
local angle = chassis.BodyAngularVelocity
local newVector = CFrame.new(0, stats.temp.Turn, 0)
local rx, ry, rz = newVector:ToEulerAnglesXYZ()
angle.AngularVelocity = chassis.CFrame:VectorToWorldSpace(Vector3.new(rx, ry, rz))

You might want to make a new post if it’s about your car not turning in specific

local chassis = car.Structure.Chassis
local angle = chassis.BodyAngularVelocity
local newVector = CFrame.new(0, stats.temp.Turn, 0)
local rx, ry, rz = newVector:ToEulerAnglesXYZ()
angle.AngularVelocity = chassis.CFrame:VectorToWorldSpace(Vector3.new(rx, ry, rz))
print(angle.AngularVelocity) -- Continuously prints (0, 0, 0)

Will do.

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.

1 Like