How do i add angles to a LookVector

Im trying to make a skill, on it i need to add angles to a look vector, and later increase even more the quantity of angles that im adding, how can i do that?

What do you mean by “adding angles to a lookvector”?

CFrame.fromAxisAngle(LookVector)*CFrame.Angles(math.deg(90), math.deg(90), math.deg(90))

You can’t change the LookVector property of something. If you want to change the orientation of something (a part for example), then you need to set the CFrame of that part.

local part = script.Parent
local partToLookAt = workspace:FindFirstChild("partToLookAt")

part.CFrame = CFrame.new(part.CFrame.Position, partToLookAt.Position)
-- makes the part look at the "partToLookAt" part, while keeping the position the same

In this example script, the part will stay at it’s current position while orienting itself so that it looks at the target part’s location.

If you have a specific angle you want to rotate the part by, then do the following:

part.CFrame = part.CFrame * CFrame.Angles(math.rad(x), math.rad(y), math.rad(z))
-- x, y, and z should be replaced by the number of degrees you want to rotate the part by on the x, y, and z axes respectively.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.