用户:
劳姆查看:38 回复:3 评论:38 创建时间:2020-03-13T20:14:41
大神们,
谁知道开车代码,
在评论区发一下,
150金币
cool-creeper//选中所有带有标签target的实体,并遍历循环.
world.querySelectorAll('.target').forEach((e)=>{
e.onEntityContact(({entity,other})=>{ //设置目标模型的碰撞事件.
if(!other.isPlayer){return} //防止非玩家实体参与检测.
other.mesh=entity.mesh; //设置玩家的外观.
other.meshScale=entity.meshScale; //设置玩家外观缩放比例.
other.player.invisible=true; //如果模型比玩家小,就需要隐藏玩家的皮肤.
})
})点赞0
评论
凌_墨水控制玩家视角 cameraEntity
• cameraEntity: Box3Entity | null = null
在第一人称视角(FPS)或第三人称跟随视角(FOLLOW)下,玩家视角所跟随的实体
cameraMode• cameraMode: "FOLLOW" | "FPS" | "FIXED" = "FOLLOW"
视角模式
"FPS" - 第一人称视角"FOLLOW" - 第三人称跟随视角(默认)"FIXED" - 第三人称固定视角示例代码
// 使用第一人称视角
world.onPlayerJoin(({ entity }) => {
entity.player.cameraMode = 'fps';
console.log('setting camera mode:', entity.player.cameraMode);
});
console.log('fps mode enabled');点赞0
评论