Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is the CFrame equivalent of "LookVector"?

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)

1 comment

0

give more info, what do you want to do on that line

1 answer

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.

2 comments

1

can you format it?

0

You can use CFrame.Angles instead of the using the Vector3 orientation. CFrame should be used for rotation anyways.

This discussion is preserved as it was. New answers, comments, and votes are closed.