alcos

Don't change the mesh position when setting the pivot

Recommended Posts

Hello everyone,

http://babylonjs-playground.com/#RZGEH#0

In the example above, on the left should be exactly what's on the right.

But, the mesh should stay in place, I don't want to change its position to compensate for the new pivot point. ajustPosition bellow should be 0.

var offsetUnit=2;
var ajustPosition=offsetUnit;
var box1 = BABYLON.Mesh.CreateBox("box1", 2, scene);
box1.position.z = -2+ajustPosition;
box1.setPivotMatrix(BABYLON.Matrix.Translation(0, 0, -offsetUnit));

How to set the pivot point and keeping the mesh in place without changing its position?

Share this post


Link to post
Share on other sites
21 hours ago, adam said:

I don't understand why you needed adjustPosition.

Because setting the pivot is moving the mesh like you can see on the right side here: http://babylonjs-playground.com/#RZGEH#3 (I would like to rotate around the second sphere by only changing the pivot). I was wondering if it is possible to set the pivot but the mesh to remain in the same position.

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.