Jump to content

Set origin or pivot of mesh


joshcamas
 Share

Recommended Posts

Ello guys!

 

I'm in dire need to set a origin of a mesh to something other than it's original values! This is to make it rotate at a specific spot. :3

 

Anyone know how to do this? I know there is "setPivotMatrix", but don't know how that workses. :D

Link to comment
Share on other sites

You can create an empty object, then attach this to a mesh by adjusting its position. so when you move the points, the mesh will follow.

var EmptyPivot = new BABYLON.Mesh("pivos", scene);
MyMesh.parent = EmptyPivot;
EmptyPivot.position.y = 5.0;

and for setPivotMatrix, I think that's the way it is used :

var matrix = new BABYLON.Matrix.TranslationToRef(0, 5, 0, MyMesh.getPivotMatrix());
MyMesh.setPivotMatrix(matrix);
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...