Using M6D.C1.Rotation.Value = Vector3.new(-47.398, -137.797, -121.055)
dosent work, and I dont understand CFrames.
CFrames basically consist of a position and rotation (there are more components, but no need to overcomplicate this for now).
To make a CFrame you use CFrame.new() for the position and then multiply that with CFrame.Angles() for the rotation (there are a lot of ways to make CFrames, but this is just how I do it)
Example:
Motor6D.C1 = CFrame.new(Vector3.new(1, 1, 1)) * CFrame.Angles(0, math.rad(90), 0) -- creates a CFrame with the position 1, 1, 1 and the rotation of 0, 90, 0
-- using math.rad to convert degrees into radians since CFrame.Angles uses radians not degrees
To make your desired CFrame you could do this:
M6D.C1. = CFrame.new(M6D.C1.Position) * CFrame.Angles(math.rad(-47.398), math.rad(-137.797), math.rad(-121.055))
If you want a function that makes the process of making CFrames easier then I constructed this:
local function MakeCFrame(position : Vector3, rotation : Vector3) : CFrame
return CFrame.new(position) * CFrame.Angles(math.rad(rotation.X), math.rad(rotation.Y), math.rad(rotation.Z))
end
Same thing, but it accepts numbers instead of vectors:
local function MakeCFrame(positionX : number, positionY : number, positionZ : number, rotationX : number, rotationY : number, rotationZ : number) : CFrame
return CFrame.new(Vector3.new(positionX, positionY, positionZ)) * CFrame.Angles(math.rad(rotationX), math.rad(rotationY), math.rad(rotationZ))
end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.