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

What is the CFrame equivalent of "LookVector"?

Asked by 4 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

Im making my own fly script, and I've inserted a bodygyro to point the angle of the character to the camera.

local running = game:GetService("RunService").RenderStepped:Connect(function()
    if Flying then
        local Bodyposition = Instance.new("BodyPosition", Character.HumanoidRootPart)
        local BodyGyro = Instance.new("BodyGyro", Character.HumanoidRootPart)

            Bodyposition.MaxForce = Vector3.new(40000000, 40000000, 40000000)
            Bodyposition.Position = Character.HumanoidRootPart.Position + Vector3.new(0, 5, 0)
            BodyGyro.MaxTorque = Vector3.new(40000000, 40000000, 40000000)
        BodyGyro.CFrame = Character.HumanoidRootPart.CFrame * CFrame.Angles(0, math.rad(workspace.CurrentCamera.CFrame.LookVector), 0) -- It is this line i am referring to :)

    end
end)
0
give more info, what do you want to do on that line VerdommeMan 1479 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

It would appear that you're just trying to get the rotation of the CFrame without the position. You can do this by simply subtracting the Position property from the whole CFrame.

1
can you format it? CaIcuIati0n 246 — 4y
0
You can use CFrame.Angles instead of the using the Vector3 orientation. CFrame should be used for rotation anyways. Dovydas1118 1495 — 4y
Ad

Answer this question