Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i move a block and ignore the X axis from A CFrame?

Asked by
Simnico99 206 Moderation Voter
6 years ago
Edited 6 years ago

Hi i want to translate that part but i wan't it to ignore the X axis i tried

local x, y, z = CamPart.CFrame:toEulerAnglesXYZ()

local CorrectedPosFrame = (CFrame.Angles(0, y, z) + CamPart.CFrame.p) * CFrame.new(0, 0, -0.1)

CamPart.CFrame = CorrectedPosFrame

Here is a picture of what i mean : https://prnt.sc/idx33k

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
  HasToStopMovingY = false  
repeat
     wait()
     local x, y, z = CamPart.CFrame:toEulerAnglesXYZ()
     local CorrectionAngleCFrame = (CFrame.Angles(0, y, z) + CamPart.CFrame.p) *
CFrame.new(0, 0, -0.1)
     local CorrectedPosFrame = (CFrame.Angles(x, y, z) + CorrectionAngleCFrame.p) * CFrame.new(0,1,1) 
    CamPart.CFrame = CorrectedPosFrame
until HasToStopMovingY == true

Ad

Answer this question