Babylon.js setting rotations of imported model 旋转模型

Babylon.js setting rotations of imported model rotates model

var Game = {player:null};
BABYLON.SceneLoader.ImportMesh("","model/","scene.gltf",scene,function(model){
model[0].position = new BABYLON.Vector3(0,0,0);
model[0].scaling=new BABYLON.Vector3(0.005,0.005,0.005);
Game.player = model[0];
});

engine.runRenderLoop(function(){
scene.render();
Update();
});

function Update(){
Game.player.rotation.y=1;
}

我打算设置导入模型的旋转。虽然我做错了,用相机测试了,但效果很好。

这只是 babylon.js 的错误还是我做错了什么?

你好,也许你的模型有一个旋转四元数设置(在这种情况下会覆盖旋转属性)

这应该可以工作:

Game.player.rotationQuaternion = null;
Game.player.rotation.y=1;