Quest 3d简单lua脚本实例

本文介绍Quest3D中使用Lua脚本的基本方法,包括如何通过脚本获取子项的值,并将该值赋给其他子项,以及如何进行简单的数值处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值