Skip to content
Advertisement

Three.js basics – Can’t find variable – GLTFLoader animation

I’ve got very basic knowledge of JS. Following three.js docs Loading 3D models I have succesfully rendered 3D object and centered it:

JavaScript

I would like to animate it now, begining with simple rotation:

JavaScript

But the problem is console returns:

JavaScript

Advertisement

Answer

You have declared model variable inside the functional scope, try to declare it outside

JavaScript

Hopefully, this will work!

Edited

as @prisoner849 suggested in the comments

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement