maronvert Posted March 15, 2014 Share Posted March 15, 2014 Hi!So I've loaded a model multiple time using this code:loader.load( "models/model.js", function( geometry ) { var mat = new THREE.MeshLambertMaterial( { map: modelTex }); for (var i = 0; i < 5; i++) { var mesh = new THREE.Mesh( geometry, mat ); mesh.position.set(i, i, i); mesh.scale.set(5, 5, 5); scene.add(mesh); }});Now I want to animate all of them individually in the animate() function.But it only animates one of the models. When I use mesh it doesn't work.How can I fix this? Thanks in advance Quote Link to comment Share on other sites More sharing options...
avrudoi Posted March 15, 2014 Share Posted March 15, 2014 if I understand you correctly. you'd better reduce the net, it is possible that the graphics card does not pull. Quote Link to comment Share on other sites More sharing options...
maronvert Posted March 16, 2014 Author Share Posted March 16, 2014 no that's not it.I just don't know how I can make the other ones move as well.I use this code to try to animate the meshes:function animate() { requestAnimationFrame( animate ); mesh.position.x += .1;}Just the last one that's added to the scene is moving though.How can I make the other ones move too? The console gives me this error : ReferenceError: mesh is not defined Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.