Zino54220 Posted January 10, 2014 Share Posted January 10, 2014 Hi everyone,First, thanks to Babylon.js!It has many potential!Now, my problem...I'm a programmer and I try to create a 3D game with Babylon.js on a wamp server and Blender v2.67.I'm learning how to create basic mesh and animation and how export it into Babylon.js.When I import a basic mesh (like a cube...) linked to many rotation keyframes (in blender...), there is no problem when playing animation in Blender and Babylon.The mesh spins well to the center of the mesh... See the files RotaInBlender.gif and RotaInBabylon.gif... In Blender : In Babylon :When I import the same mesh linked to a skeleton and repeat the process of the creation of the rotation keyframes (linked to the skeleton this time...),there is no problem in Blender but the animation in Babylon.js is not the same... See the files RotaInBlenderWithSkel.gif and RotaInBabylonWithSkel.gif... In Blender : In Babylon : It's like the mesh doesn't spin but turn around a new offset center but I don't understand because the center of the bone is the same that the mesh center in Blender!I see many options to repeat the process of the creation of the rotation keyframes in Blender with different properties "Rotation Mode" like : XYZ Euler, Axis, Quaternion(WXYZ)... but always the same result.What i'm doing wrong please ?I can send file .blend or .babylon if anyone want help me.Thanks you for your help, i real need it!PS :Sorry for my bad english, i'm French and it's my first forum... Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted January 11, 2014 Author Share Posted January 11, 2014 I precise that I used the property "With Automatic Weight" in Blender to link the mesh and th skeleton... Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted January 11, 2014 Author Share Posted January 11, 2014 Up please... Quote Link to comment Share on other sites More sharing options...
gwenael Posted January 11, 2014 Share Posted January 11, 2014 Hi Zino, I haven't played with animations so far with BabylonJS but like you suggested there could be an offset. The pivotMatrix could be different than the identity matrix or the positions of the vertices are not expressed in the correct space. (or the skeleton, but I have no idea how it's used in BabylonJS) Yes it could be helpful if you could share your files. Not sure I will have look on them over the week-end but I may be able to read them on Monday or someone else will fix the issue before that. Here are two of my answers to other posts where vertices and pivot are discussed: http://www.html5gamedevs.com/topic/2864-how-to-set-meshs-center-and-how-to-setphysicsstate-at-heightmap/?p=18572http://www.html5gamedevs.com/topic/2872-basic-math-knowledge-for-video-games/?p=19594 Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted January 11, 2014 Author Share Posted January 11, 2014 Hi and thanks for your reply gwenael. Here, my files : files_cubes.zip Blender file is "cube.blend" and the Babylon file is "cube.babylon". (Captain obvious... ^^ ) The file "cube.babylon" was generated with the exporter "io_export_babylon.py" from babylon v 1.7.3. I'll try soon the function "setPivotMatrix(...)" and will inform you. PS : Thanks again ! Quote Link to comment Share on other sites More sharing options...
ProfessorF Posted January 12, 2014 Share Posted January 12, 2014 Sounds like you didn't create vertex groups. Okay, so let's say you have a cube with a bone, like this: And you want it to rotate as follows (I'm assuming you've done the keyframe animation): (just to see the rotation better, I threw in a texture of Kesha and I--please don't hold that against me haha) The trick is to select the armature and the cube, then Ctrl-P followed by selecting "Armature Deform with Automatic Weights". This will create the vertex groups for you. It looks like this after you Ctrl-P: Then export as .babylon Good luck. Let me know if that helped. - Nick p.s., I remember one last thing when you play the animation, you have to set start=0 and end=100: scene.beginAnimation(Skeletons[0], 0, 100, true, 1); p.p.s, I remembered also that you should bake the translation, rotation, and scaling into the vertices--so that the parent transformation matrix = Identity matrix. To do so, with the cube selected in object mode, type: ctrl-A > Location then ctrl-A > Rotation & Scalerotatingcube.zip gwenael and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted January 12, 2014 Author Share Posted January 12, 2014 You brought my answered, ProfessorF! It was : p.p.s, I remembered also that you should bake the translation, rotation, and scaling into the vertices--so that the parent transformation matrix = Identity matrix. To do so, with the cube selected in object mode, type: ctrl-A > Location then ctrl-A > Rotation & Scale So, when you have link your skeleton and the mesh, created your rotation keyframes, you need to apply the precedent steps like say Nick and it's done! PS : Thanks you very much to Gwenael & ProfessorF for their devotion to the community ! gwenael 1 Quote Link to comment Share on other sites More sharing options...
gwenael Posted January 12, 2014 Share Posted January 12, 2014 So I was right: someone found the solution before I open your files. Thank you ProfessorF! Glad to read your finally got what you wanted, Zino. Quote Link to comment Share on other sites More sharing options...
ProfessorF Posted January 12, 2014 Share Posted January 12, 2014 Always happy to help the community, you guys are also very helpful to me! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 14, 2014 Share Posted January 14, 2014 Congratz guys Quote Link to comment Share on other sites More sharing options...
gwenael Posted January 14, 2014 Share Posted January 14, 2014 This, http://www.html5gamedevs.com/topic/3083-spaces-world-parent-pivot-local/?p=19938, could be useful for another time. 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.