Why can’t I change the y of ObjectContainer3D???

Software: Away3D 4.x

glasses, Newbie
Posted: 23 April 2013 10:00 AM   Total Posts: 28

Hi, all. Today I encountered a strange problem. For instance, modelA is an ObjectContainer3D, which contains several meshes and is the child of another ObjectContainer3D named models. And I cloned the modelA like the code shown below:


private var modelB:ObjectContainer3D;
private var modelC:ObjectContainer3D;
......
var distance:Number = 10;
modelB = ObjectContainer3D(modelA.clone());
modelB.y -= distance;
modelC = ObjectContainer3D(modelA.clone());
modelC.y -= distance * 2;
models.addChildren(modelB, modelC);


However, I found these three ObjectContainer3D actually overlapped each other. In other words, modelB and modelC didn’t move along the y axis as expected. But when I traced the position of each one, I found their y values did change!!! Moreover, if I changed other property such as rotationX, it did rotate. After that, I also tried to change the y value of models, namely their parent container, and it moved too. So I got no idea about this issue…
Is that something wrong happened when I used addChildren method???

Hope someone could answer me. Thanks in advanced!

   

SuperSam, Sr. Member
Posted: 23 April 2013 11:12 AM   Total Posts: 102   [ # 1 ]

I don’t know what’s up. The following works for me.

var models:ObjectContainer3D = new ObjectContainer3D();
var 
modelA = new ObjectContainer3D();
modelA.addChild(new Mesh(new CubeGeometry()));
models.addChild(modelA);
view.scene.addChild(models);   // View3D instance


var distance:Number 150.0;
var 
modelB:ObjectContainer3D ObjectContainer3DmodelA.clone());
modelB.+= distance;
var 
modelC:ObjectContainer3D ObjectContainer3DmodelA.clone());
modelC.+= distance 2;
models.addChildren(modelBmodelC); 

Your bug must be elsewhere or your Away3D build is broken. Mine is a 4.1 Alpha fresh from a week or two ago.

   

glasses, Newbie
Posted: 23 April 2013 12:16 PM   Total Posts: 28   [ # 2 ]

Hi, Sam. Thank you so much for your quick reply.
In my case, the models, modelA and their parent-child relationship were actually created in 3D software. Do you think that is the reason?

   

SuperSam, Sr. Member
Posted: 23 April 2013 01:49 PM   Total Posts: 102   [ # 3 ]

Hi smile

I never encountered this problem, and my experience with 3D modelling is limited.

So I’m afraid I can only help troubleshooting further if you provide me with your models along with their loading, parsing and instancing bits of code, because I couldn’t create such a model and be sure that it matches your setup. If it’s the kind of art that you just can’t share well… maybe someone more knowledgeable will come to the rescue and be able to help off-hand smile

   

Avatar
Fabrice Closier, Administrator
Posted: 23 April 2013 02:14 PM   Total Posts: 1265   [ # 4 ]

Load your model into Prefab, and look in hierarchy panel to see if they are as intended.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X