jellix Posted May 1, 2016 Share Posted May 1, 2016 Hi (my first post here), I've imported an obj file sucessfully. It's a simple human, consisting of seperate parts linke arms and legs (the usual "human" object of cinema 4D). Within the 3D-file, the pivot of the leg is placed at the hip of the human. When I rotate it in babylon, the leg is rotated about the 0, 0, 0 position of the world instead of it's pivot. When I position the leg at 0, 0, 0 it doesn't move (with 0,1,0 it's higher). So the pivot of the leg seems to be at 0, 0, 0 of the world instead of it's original position within the obj-file. -------------- So the question is: How can I rotate the leg around it's original pivot? Thanks for help! human.obj Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 2, 2016 Share Posted May 2, 2016 Hello! we may need several info: how do you export your .babylon file? Pivot should be kept by exportation Can you share a small repro in the playground? Quote Link to comment Share on other sites More sharing options...
jellix Posted May 2, 2016 Author Share Posted May 2, 2016 Hello Deltakosh, thanks a lot for your answer. It's not a .babylon file but an obj. I've attached it to the first post. I will try to build a scene with that in the playground and post it here. later or tomorrow :-) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 2, 2016 Share Posted May 2, 2016 Oups sorry did not see it....this may be a problem from the obj importer. @Temechon could help perhaps Quote Link to comment Share on other sites More sharing options...
Temechon Posted May 3, 2016 Share Posted May 3, 2016 Here is a playground : http://www.babylonjs-playground.com/#2KUXPG The obj format has no specification for pivot points, so I guess the pivot point is (0,0,0) for each mesh. Quote Link to comment Share on other sites More sharing options...
jellix Posted May 3, 2016 Author Share Posted May 3, 2016 I'm so sorry! You are right, the obj file has no further hierarchy and no specific pivot point. Another reason why I should use glTF. Thank you anyway! Wingnut 1 Quote Link to comment Share on other sites More sharing options...
lesterhaus Posted May 3, 2016 Share Posted May 3, 2016 As I learned from other threads you can set the pivot manually after loading your obj. Just be aware that this displaces your mesh together with the pivot point, so you'd have to compensate this by resetting the position accordingly let pivotCenter = mesh.getBoundingInfo().boundingSphere.center; mesh.setPivotMatrix(BABYLON.Matrix.Translation(pivotCenter.x, pivotCenter.y, pivotCenter.z)); mesh.position = selectPlaneMesh.position.add(new BABYLON.Vector3(-pivotCenter.x, -pivotCenter.y, -pivotCenter.z)); Wingnut 1 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.