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

Rotating a Part only at a single axis?

Asked by 5 years ago

I've been trying to make a part rotate only at 1 axis and traditional .Rotate requires 3 Axis, which is not what I need.

Specifically I'm trying to make a camera follow the player, so far what I did is add BodyPosition to the part(CamPart) and attach the camera to it, so that there's a small motion effect.

local function RunRender()
    if CamPart then
    BodyPosition.Position = Character.Head.CFrame:pointToWorldSpace(Vector3.new(0, 10, 30))
    CamPart.Rotation = Character:WaitForChild("HumanoidRootPart").Rotation 
    Camera.CFrame = CamPart.CFrame
    end
end
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, RunRender)

Now everything here works perfectly except that there's too much motion, from every axis and I blame this part

CamPart.Rotation = Character:WaitForChild("HumanoidRootPart").Rotation -- Uses all 3 axis

All I need is for the camera to rotate at a single axis(Left, Right).

0
im not sure if this will work but try CamPart.Rotation.X = Character:WaitForChild("HumanoidRootPart").Rotation.X radusavin366 617 — 5y
0
Tried that but ROBLOX Studio gives an error. Figured it's cause the X is only a readonly value KhanPython 7 — 5y
0
oh then try CamPart.Rotation = Vector3.new(Character:WaitForChild("HumanoidRootPart").Rotation.X, CamPart.Rotation.Y, CamPart.Rotation.Z) radusavin366 617 — 5y
0
Not quiet what I need KhanPython 7 — 5y
View all comments (3 more)
0
what do you mean? radusavin366 617 — 5y
0
Think there is another method maybe? KhanPython 7 — 5y
0
whats wrong with that method as long as it works? radusavin366 617 — 5y

Answer this question