Hi,
I’m trying to implement a simple game in BabylonJS. I have managed to load a game world which I created in blender, together with obj/mtl model of a player and got the player to move around the world with a collision detection, however now I wanted to swap the simple player model to some animated gltf model, but do not quite understand how to update the loaded gltf model position. The model loads but it ends up under the world.
The way load the gltf model is through this example
BABYLON.SceneLoader.ImportMesh("him", "Scenes/Dude/", "Dude.babylon", scene, function (newMeshes, particleSystems, skeletons) {
var dude = newMeshes[0];
dude.rotation.y = Math.PI;
dude.position = new BABYLON.Vector3(0, 0, -80);
scene.beginAnimation(skeletons[0], 0, 100, true, 1.0);
}),
However, changing the position/rotation of the object does not change anything. When I have loaded the model into the BabylonJS sandbox, I am able to rotate/translate the model.
Another questions is the model which I’m using has some animations, they are stored inside the animationsGroup property, how could I specify which animation should the object perform, upon loading into the game it plays the first animation from the animationsGroup.
The model which I have used is located here
Thanks for any help