Search the Community
Showing results for tags 'addrotation'.
-
Having had a look at the playgrounds using Jerome's new addRotation I started wondering about line 39 in http://www.babylonjs-playground.com/#1PON40#4 torus.rotation.copyFromFloats(0.0, 0.0, Math.PI / 2); the torus had already been set as vertical so why was it necessary to re-do it. On commenting out this line and running the PG again the wheel wobbles (quite a lot very soon). So I decided it had to do with stopping error accumulation. My next thought was why copyFromFloats and not just use. torus.rotation = new BABYLON.Vector3(0, 0, Math.PI/2); This does work as in http://www.babylonjs-playground.com/#1PON40#9 From advice about something else that Jerome gave me I decided that it had something to do with avoiding constructing new variables and garbage collection. My next thought was would this be avoided if I set a variable to be the vector3 (0, 0, Math.PI/2) and used this each time. So I created var vRot = new BABYLON.Vector3(0, 0, Math.PI/2); and then in the render loop used torus.rotation = vRot; result more extreme wobbling as in http://www.babylonjs-playground.com/#1PON40#10. If you do a console.log(vRot) in the loop its value changes. The simple question is why? What fundamental misunderstanding have I made this time? (Probably something to do with my use of Javascript rather than BJS)