Jump to content

Scale Scene Maintain Relative Position


reddozen
 Share

Recommended Posts

Is there a way to join meshes together so that even if they're scaled, they maintain their joined position?

 

Example:

I have a terrain and sepraite tree meshes. If i want to scale the entire scene down how can I make sure that the location of the trees stays relative to their original position on the terrain?

Link to comment
Share on other sites

Hi, 

 

I don't know if it exists a way to do that automatically in Babylon, But i would link the tree position to the terrain actual size: 

tree.position = getTreePosition(terrain)

Something like this.

 

That's basicially what I'm asking. If there's a way to join the 2 meshes at a point or combine them.

Link to comment
Share on other sites

To join two meshes, you can use the property "parent" on a mesh to join another one : 

tree.parent = terrain

This way, all transformations done on terrain will be done to the tree as well.

 

But i'm not sure this will keep the tree relative position on the terrain. In this case, you will have to do the work with your own code.

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