Jump to content

How can I change the origin point of a imported mesh dynamically in Babylon?


hit2501
 Share

Recommended Posts

Hi, I wonder if this is posible but dynamically in Babylon instead Blender:

 

I can change the size of a mesh with some sliders and .scaling but this only works starting from the origin point. I tried Pivot Point but this seems to work the first time and then the mesh changes location (to pivot point) and the scaling continues working taking the new central point.

Also I can find the coordinates for each vertex but I dont know how to move the origin point to that vertex.

Is there any way to change the origin point to be able to scale starting from that point?  

Thank you.

Link to comment
Share on other sites

You can set the Pivot Point in BabylonJS with the pivot matrix, but there are two methods, so good to know the difference:

mesh.setPivotMatrix(pivotMatrix)
mesh.setPreTransformMatrix(preTransformMatrix)

Otherwise maybe you can export your model and we can work together on a Playground.  Here I'm just changing scaling and it is making the mesh scale the same as your video with a blender origin:
https://www.babylonjs-playground.com/#AVXVIQ#2

Link to comment
Share on other sites

12 hours ago, hit2501 said:

I tried Pivot Point but this seems to work the first time and then the mesh changes location (to pivot point) and the scaling continues working taking the new central point.

This behaviour depends on the version of babylon.js you are using see https://doc.babylonjs.com/how_to/pivots#breaking-change

 

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...