Jump to content

Rotating imported mesh around it's pivot?


jellix
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 :-)

Link to comment
Share on other sites

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));

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...