CFrame rotation

I have two CFrames and I want to set the rotation of the first CFrame like the second but just in the Y axis For example, if the two parts starts like that
image
After changing the CFrames I want to be them like this,
image

1 Like

I think you can use “Cframe.Angle”, example

Part.cframe *= Cframe.angle(0,math.rad(90),0)

part1.Orientation.Y = part2.Orientation.Y

or

part1.Orientation = Vector3.new(part1.Orientation.X, part2.Orientation.Y, part1.Orientation.Z)

part 1 being your blue part

this will work on parts but I need to use cframes because “part1” is the PrimayPart of a model that I need to rotate and this will make part1 rotate alone in the model

okay but what if the red part was not 90?

I did that on every part in the model and that worked

1 Like

can u explain what does the y do in orientation?

Basically almost every teritorial property (position, rotation, scale) of the part is in 3D. 3D means that there are 3 axis, X, Y, and Z. Usually when you re rotating a part perpendicular to the ground, you are changing the parts rotation by Y, and leaving x and z untouched

1 Like

Glad could hape mate :slight_smile:

Also, something similar should work with CFrames too, im just not too experienced with them. I think it should be

CFrame.Angles(part1.Orientation.X, part2.Orientation.Y , part1.Orientation.Z)

if this doesnt work, then you need to specify it in radians, like this

CFrame.Angles(math.rad(part1.Orientation.X), math.rad(part2.Orientation.Y) , math.rad(part1.Orientation.Z))