spoboyle Posted January 23, 2017 Share Posted January 23, 2017 http://www.babylonjs-playground.com/#18OA3I#6 I seem to be having a problem understanding rotations. I have imported a model and am attempting a couple of things but first problem scene.getMeshByName("Cylinder002").rotation.y += 0.01; and scene.getMeshByName("Cylinder002").rotation.z += 0.01; seem to rotate the model about the same axis. can anyone explain whats going on? Also the rotation doesn't seem to occur around the centre on the object. this does seem to do what I want to do (even if i can't get my camera in the correct position for the moment) scene.getMeshByName("Cylinder002").rotate(new BABYLON.Vector3(0, 1, 0), 0.01, BABYLON.Space.LOCAL); Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 23, 2017 Share Posted January 23, 2017 runRenderLoop = a render Loop always render, everything. registerBeforerender = before the renderLoop (physics, meshoptimasation etc) afterRender = after the renderLoop (everything loaded?, shaders are compiled etc.) You have to reset the origin "pivotPoint" of your model you can do it i a 3D modeling soft or per code see: Quote Link to comment Share on other sites More sharing options...
spoboyle Posted January 23, 2017 Author Share Posted January 23, 2017 I believe my pivot is correct but I'll double check. The issue remains on why rotation.y seems to have the same effect as rotation.z Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 23, 2017 Share Posted January 23, 2017 Report what for a 3d Modeling Program you are using, in case of Blender you have to apply Rotation&Scale before exporting in any other case it looks like this:http://www.babylonjs-playground.com/#18OA3I#8 Quote Link to comment Share on other sites More sharing options...
adam Posted January 23, 2017 Share Posted January 23, 2017 Gimbal Lock Your meshes rotation x is set to Math.PI*.5. spoboyle and Nabroski 2 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 23, 2017 Share Posted January 23, 2017 nice. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 23, 2017 Share Posted January 23, 2017 Okay, so you can open your .babylonfile in a txt editor of your chose you will see some data and then "name":"Cylinder002","position":[0.0,0.0,14.375],"rotation":[-1.5708,0.0,0.0], this is the problem the initial rotation of your mesh. Its not the PivotPoint. Thanks Adam. Quote Link to comment Share on other sites More sharing options...
adam Posted January 23, 2017 Share Posted January 23, 2017 You can also do it at runtime. http://www.babylonjs-playground.com/#18OA3I#9 Nabroski 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 23, 2017 Share Posted January 23, 2017 Yes, in Blender you got a function: Apply Rotation Apply Scale. So the position(s), rotation(s), transformations etc. will be zeroed and handel as the initial value for a mesh and then exported correctly. you have to look for it in 3D Max. adam 1 Quote Link to comment Share on other sites More sharing options...
spoboyle Posted January 24, 2017 Author Share Posted January 24, 2017 the modeller is 3ds max 2017. thanks Adam that looks like this will solve all my issue 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.