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

Why is this script only changing the lookvector by a really, really tiny bit??

It only changes it by a tiny bit, like it only adds one ten-thousandth to the axis.

help

local camcenter = workspace.CameraCenter
local ccframe = camcenter.CFrame

local MaxIncrement = 10
local increment = 	 1

local uis = game:GetService("UserInputService")

uis.InputBegan:connect(function(input)
	print("InputDetected")
	if input.UserInputType == Enum.UserInputType.Keyboard then
		print("KeyboardInputDetected")
		if input.KeyCode == Enum.KeyCode.E or input.KeyCode == Enum.KeyCode.Q then
			print("WUPInputDetected")
			if (ccframe.LookVector + Vector3.new(0, 0, increment)).Z < Vector3.new(0, 0, MaxIncrement).Z then
				print("Changing")
				local newcframe = CFrame.new(Vector3.new(0,0,0), Vector3.new(ccframe.LookVector.X, ccframe.LookVector.Y, ccframe.LookVector.Z + increment)) 
				ccframe = newcframe
				print(ccframe.LookVector.Z)
			end
		end
	end
end)


1 answer

✓ Accepted answer

LookVectors are unit vectors and are limited between the bounds of -1 to 1 and will never exceed either.

1 comment

1

To add onto this, it is common to multiply the unit by a number if you want the vector to move more.

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