用户:
宁静倒数28天查看:462 回复:5 评论:23 创建时间:2022-03-18T09:41:36
最近建图时 做NPC交互总是报错 我照着吉吉喵的视频也报错 求大佬帮忙 imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E4%BC%A4%E5%BF%83.gif"alt="emotion_编程猫_伤心"
// 先在场景中放置一个名称为 NPC 的实体。
const npc = world.querySelector('#NPC');
npc.enableInteract = true; // 允许进行互动
npc.interactRadius = 16; // 实体的互动范围
npc.interactHint = npc.id; // 互动提示框显示实体的名称
npc.interactColor = new Box3RGBColor(1,0,1); // 互动提示的文字颜色
// 玩家与实体进行交互时触发
npc.onInteract(async({entity}) => {
const result = await entity.player.dialog({
type: Box3DialogType.TEXT, // 对话框的类型,TEXT是文本框。
title: npc.id, // 对话框标题为NPC名字,表示正在说话的是NPC
lookEye: entity, // 将相机放在玩家位置
lookTarget: npc, // 相机镜头对准NPC
content: `你好,${entity.player.name},很高兴认识你。`,
});
});
点赞0
评论
模型要把后面的-1去掉,有问题回我
或者链接发我,帮你写
这是参加比赛你还能帮?
……
你看一下你Box3有个叫‘鸡汤来咯!1.0.0’的创作段(合作)
你去吗
你谁啊
我呀……你去了就知道
我叫外向的雷电猴(巅峰队)
还是报错呀
https://box3.codemao.cn/e/1dd0f00617c3380afc1c
帮我看看吧
你人呢
我现在开始一直在
应该是吉吉喵出问题了
你确定这是你写的代码。。。这就是API里的好不好。。。
。。。他不会复制。。。
雷电猴在吗
你过来看一下
哦OK
// 先在场景中放置一个名称为 NPC 的实体。
const npc = world.querySelector('#NPC');
npc.enableInteract = true; // 允许进行互动
npc.interactRadius = 16; // 实体的互动范围
npc.interactHint = npc.id; // 互动提示框显示实体的名称
npc.interactColor = new Box3RGBColor(1,0,1); // 互动提示的文字颜色
// 玩家与实体进行交互时触发
npc.onInteract(async({entity}) => {
const result = await entity.player.dialog({
type: Box3DialogType.TEXT, // 对话框的类型,TEXT是文本框。
title: npc.id, // 对话框标题为NPC名字,表示正在说话的是NPC
lookEye: entity, // 将相机放在玩家位置
lookTarget: npc, // 相机镜头对准NPC
content: `你好,${entity.player.name},很高兴认识你。`,
});
});点赞1
评论
你好啊四年前的我