用户:
kingsss查看:4 回复:4 评论:4 创建时间:2022-07-02T14:30:01
模仿一个二维游戏,须要俯视视角,
world.onPlayerJoin(async function({entity}){
entity.player.cameraMode=Box3CameraMode.RELATIVE;
entity.player.cameraPosition=new Box3Vector3(-0.01,40,0);
entity.player.swapInputDirection=true;
entity.player.reverseInputDirection=Box3InputDirection.HORIZONTAL;
entity.player.cameraFreezedAxis=Box3CameraFreezedAxis.Y;
entity.player.freezedForwardDirection=new Box3Vector3(0,0,1);
});
来源:编码喵
点赞2
评论
百年匠魂个人理解,如有错误,多加见谅
world.onPlayerJoin(async ({ entity }) => {
entity.player.cameraMode = Box3CameraMode.RELATIVE//视角模式
entity.player.cameraPosition = new Box3Vector3(-25, 25, 0)//相机相对位置(以玩家位置为x:0,y:0,z:0点,x移动-25,y移动25,z移动0)
entity.player.swapInputDirection = true//调整按键方向(以镜头方向为“前”)
entity.player.reverseInputDirection = Box3InputDirection.HORIZONTAL//按键颠倒(此处为“横向颠倒”,因为视角与坐标相冲突,导致左右颠倒)
entity.player.cameraFreezedAxis = Box3CameraFreezedAxis.Y//[本行可以去掉]相机坐标锁定(所指定的会锁定在0,未指定的跟随玩家,并按cameraPosition移动),这里表示相机x,z跟随玩家位置,y锁定0,再按cameraPosition移动
entity.player.freezedForwardDirection = new Box3Vector3(0, 0, 1)//相机旋转
})点赞0
评论