Sign in to follow this  
Followers 0
Brijesh

Change position of meshes

3 posts in this topic

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

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.