Jump to content

Change position of meshes


Brijesh
 Share

Recommended Posts

I have 20 meshes, By connecting each other i make one object and apply rotation to some mashes. Its working fine.

Now i want to change position of all meshes dynamically (As per i got a data from server Ex. x = 2 and y = 3 than move all meshes in x and y direction from current position).

I set one parent mesh for all 20 meshes and set position of parent mesh but when i set position of parent mesh its set position of only rotated meshes. static meshes's positons are not change.

 var parentMesh = BABYLON.Mesh.CreateBox('pmesh',50, scene);
               parentMesh.isVisible = false;
               for (i = 0; i < a1.length; i++)
               {   
                  a1.parent = parentMesh;
               }

First add all meshes in array a1.

parentMesh.position.x = a;
parentMesh.position.y = b;

But issue is not apply position change effect to all meshes, few meshes position is as it is not change.

Please help me out of this issue....!!!!!!!!!!!

Link to comment
Share on other sites

Hi guys.  I see a mistake in your code, but the forum caused it.  The forum is interpreting the openBracket i closeBracket as a "switch to italics" directive.  We'll try a "code block" gotten from selecting "insert code snippet" button in forum editor...

for (i = 0; i < a1.length; i++)
{   
    a1[i].parent = parentMesh;
} 

There, that looks better.  Still need testing playground, though.  A1... contains ALL child mesh, rotated or not, right?  A1 has length 20?
 

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