Quest 3d简单lua脚本实例

Quest 3d简单lua脚本实例,下面实例主要实现取得子项的值,以给赋值给子项

-- CallChannel function is called when channel is called
function CallChannel()
	

local version
local Channel = channel.GetChild(0)

	
	
version = _VERSION
	
Channel:SetText(version)
	
end

-- GetValue function is called when this channels is used as Value
function GetValue()
	return -1
end


-- CallChannel function is called when channel is called
function CallChannel()
	

local ValueChannel = channel.GetChild(0)
local TextChannel = channel.GetChild(1)
local ResultChannel = channel.GetChild(2)

local Value = ValueChannel:GetValue()
local text
local result
	
	
text = tostring (Value)
TextChannel:SetText(text)
	
result  = tonumber(text)*2

ResultChannel:SetValue(result)	
	
	
end

-- GetValue function is called when this channels is used as Value
function GetValue()
	return -1
end



你可能感兴趣的:(虚拟现实)