用户:
可爱的笨笨鸭yeuU查看:4 回复:4 评论:4 创建时间:2023-01-27T14:09:19
代码岛3.0谁能教我让模型有按钮
名探酱const npc = world.querySelector('#模型名称');
npc.enableInteract = true; // 允许进行互动(主代码)
npc.interactRadius = 6; // 实体的互动范围
npc.interactHint = npc.id; // 互动提示框显示实体的名称
npc.interactColor = new Box3RGBColor(1,0,1); // 互动提示的文字颜色(可不用)点赞0
评论
// 先在场景中放置一个模型()()。
const a = world.querySelector('#NPC');
a.enableInteract = true; // 允许进行互动
a.interactRadius = 3; // 模型的互动范围,现在是3格
a.interactHint = a.id; // 互动提示框显示实体的名称,a.id就是模型名称
a.interactColor = new Box3RGBColor(1,0,1); // 互动提示的文字颜色
// 玩家与实体进行交互时触发
a.onInteract(async({entity}) => {
const result = await entity.player.dialog({
type: Box3DialogType.TEXT, // 对话框的类型,目前是文本框。
title: a.id, // 对话框标题为模型名字
content: `你要填什么内容()()()`,
});
});点赞0
评论