cyc = 0
added = false

registerForEvent("onUpdate", function()
    local res = GetAsyncKeyState(0x42) -- press V
    if res ~= space_state then
        space_state = res
        if space_state then

			player = Game.GetPlayer()
			fpp = player:GetFPPCameraComponent()
			
			if(added == false) then
				Game.AddToInventory("Items.PlayerMaPhotomodeHead",1)
				added = true
			end
			
			newCam = Vector4.new(0.0, 0.0, 0, 1.0)
			newQ = Quaternion.new(0.0, 0.0, 0.0, 1.0)
			
            cyc = cyc + 1
			
			print("JB TPP MOD: Cyc camera = " .. cyc)
			
			if(cyc == 5) then
				print("JB TPP MOD: Set Cyc back")
				cyc = 0
			end
			
			if(cyc == 0) then
				Game.EquipItemOnPlayer("Items.PlayerMaPhotomodeHead", "TppHead")
			end
			
			if(cyc == 1) then -- To Back
				Game.EquipItemOnPlayer("Items.PlayerMaPhotomodeHead", "TppHead")
				
				newCam = Vector4.new(0.0, -4.0, 0, 1.0)
			end
			
			if(cyc == 2) then -- To front
				newCam = Vector4.new(0.0, 4.0, 0, 1.0)
				newQ = Quaternion.new(50.0, 0.0, 4000.0, 1.0)
			end
			
			if(cyc == 3) then -- To right shoulder
				newCam = Vector4.new(0.5, -2.0, 0, 1.0)
			end
			
			if(cyc == 4) then -- To left shoulder
				newCam = Vector4.new(-0.5, -2.0, 0, 1.0)
			end
			
			fpp:SetLocalPosition(newCam)
			fpp:SetLocalOrientation(newQ)
        end
    end
end)