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

How do I add an angle to LookVector?

How can I add an angle to the current LookVector to make it more downwards? I have a slash attack that goes forward(direction, LookVector) from the HumanoidRootPart, but when I jump, I want it to go downwards. But, I don’t know how to add on to a LookVector, so I need help.

I have tried multiplying the LookVector with CFrame.Angles() but it is not working and it says I need a Vector3. I tried to do Orientation but I just don’t know anymore. If there is any solutions to this or alternative solutions I just need to know.

if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
			local downdirection = CFrame.Angles(0,math.rad(90),0)
			end
		
			local rainbowslash = game.ServerStorage.rainbowslash:Clone()
			print("rainbowslash clone")
			rainbowslash.Parent = player.Character.Head
			rainbowslash.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(math.random(-1,1),math.random(-1,1),-1)
			rainbowslash.Orientation = rainbowslash.Orientation + Vector3.new(180,0,math.random(-100,100))

		local vel = Instance.new("BodyVelocity", rainbowslash) --velocity
			vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			print(player.Character.HumanoidRootPart.CFrame.LookVector)
			vel.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * speed -- I don't know how to add an angle to this, I want to make it more downwards (I want to add on downdirection variable to this but it just wont work, it has errors)
			print(vel.Velocity)
		game.Debris:AddItem(rainbowslash,lifetime)

1 answer

vel.Velocity = player.Character.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(45), 0, 0).LookVector * speed

I THINK this might work, try it out and tell me if it does or doesn't.

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