How to CFrame the axis?


I was wondering how you math.abs a CFrame.Y or any of the axis? This might sound like a stupid question but I really don’t know how to use the CFrame axis.


Assuming you want to get the absolute value for each of the CFrame’s positional components, doing the following should be sufficient (this would also work if you want to round up each value):

local oldCFrame = --Whatever CFrame you have and want to adjust

local origin = oldCFrame.Position --The position component of the CFrame
local absX = math.abs(origin.X) --We take the absolute of each individual component
local absY = math.abs(origin.Y) 
local absZ = math.abs(origin.Z) 

local newCFrame =,absY,absZ)) * oldCFrame.Orientation
--First we create a new CFrame without any rotation (0,0,0), then add the orientation onto it

Hope this helps!

1 Like

In order to access the X, Y and Z components of the CFrame intuitively, you have to access its position vector via cframe.Position. So if your CFrame is in a variable called cf, you would access its Y component via cf.Position.Y. You can then use math.abs as normal: math.abs(cf.Position.Y).

Technically, you can also access the coordinates via the matrix elements, but using the Vector3 is more intuitive.

1 Like

@Lomstair, @qwertyexpert,

Thanks for the feedback! :smiley: