猫史档案馆


如何做俯视视角???

用户:kingssskingsss查看:4 回复:4 评论:4 创建时间:2022-07-02T14:30:01


模仿一个二维游戏,须要俯视视角,


回复

上一页1 页 / 共 1下一页
企鹅vItY企鹅vItY

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


评论


kingssskingsss

类似于“王者荣耀”中的

点赞0


评论


kingssskingsss

可以向下斜一点不?

点赞0


评论


百年匠魂百年匠魂

个人理解,如有错误,多加见谅

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


评论