I am a 3D graphic artist and a very (emphasis on the very) amateur programmer. So this library is at times very overwhelming for me and frustrating as even the most basic 3D task is quite complex (in a good way).
I am essentially trying to jerry-rig it onto the Construct 3 game engine to mixed results. I can now get objects to load in the view(playing an animation automatically.) I have noticed that a lot of the examples use something called AnimationGroups. but I have no idea how to change them from one to another.
This is the scene creation function that I am using:
var createSceneGTLF = function (canvas, engine) {
var scene = new BABYLON.Scene(engine);
//Adding a light
var light = new BABYLON.HemisphericLight();
//Adding an Arc Rotate Camera
var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 10, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, false);
//THIS MAKES SURE NO LOADING SCREEN!
BABYLON.SceneLoaderFlags.ShowLoadingScreen = false;
// The first parameter can be used to specify which mesh to import. Here we import all meshes
var anims = [];
var stp = 2;
var vel = 1;
var alienload = BABYLON.SceneLoader.Append("https://cdn.jsdelivr.net/gh/NRABrasil/ar@79c50129b36d9b326afbe28fac6e6f7508567436/", "rooster5.glb", scene);
alienload.onSuccess = function (task) {
scene.activeCamera = null;
scene.createDefaultCameraOrLight(true);
scene.animationGroups[1].play(true);
// scene.activeCamera.attachControl(canvas, false);
};
scene.clearColor = new BABYLON.Color4(0.0, 0.0, 0.0, 0.0);
return scene;
}
Sorry if the paste becomes unformatted, I am new to the forums.
But as you can see I have tried many things to change the Animation but to no avail.
Also, how would I go about referring to the newly created object in a new function? would the var that I have specified work outside of the create function?
Sorry if this is a long one, I have so many more questions but I thought I ought to keep this short for now.
Any help or guidance would be much appreciated.
All the best,
Harry.