Problem getting position values of meshes in the scene with AWD

Software: Away3D 4.x

Kodremus, Newbie
Posted: 25 October 2012 06:22 PM   Total Posts: 3

Hello everyone,

I was using the file format OBJ, but decided to try using AWD. However, I seem to be having a problem getting the position of meshes in my scene.

For example, if I try to get the x of an object through mesh.x, it will return 0. The object is placed at the same position as it is in 3dsMax, but when I try to get the position values, they are all 0. I actually had the same problem when using OBJ, but with OBJ when I would use minX or other such values, it would give me the minX relative to the position.

For example, the minX and maxX of an object when I use OBJ would be about 596 and 599. Which makes the x be at about 597.5 which is the position it has in 3dsMax. However, when I do the same with AWD instead, the minX and maxX are -2 and 2, which makes the position be at 0, so I can’t use the minX and maxX to find the x position like I did with OBJ.

However, I found that if a mesh is attached to a bone in 3dsMax with the skin modifier, then when I get the minX and maxX of the mesh it will match with the position of the bone, so if the bone is at the same position as the mesh, then I can use that to find the position values of the mesh.

Anyway, I was just wondering if there might be something I am doing wrong. If I have a scene made in 3dsMax and I export it into AWD, then when I use it in Away3D should I be able to find the position values of different meshes inside the same file even if they are not attached to a bone?

   

Avatar
Fabrice Closier, Administrator
Posted: 26 October 2012 01:02 PM   Total Posts: 1265   [ # 1 ]

obj “bakes” the transforms into the v tags. Obj doesn’t tell you anything about scenegraph. What Prefab does to help a bit is (if “recenter at load” is on in prefs), it does what you describe. using object space data bounds and set the position in the center of this data.
Well, this is handy but wrong, because any pivot/offset/rotation information gets lost.Its not Prefab fault or your exporter, its just the way obj format works. The way you export to awd in max is doing similar, like if all object data center is at 0,0,0.

So if you want export as awd yet have the positions extrapolated from center bounds. export as obj and load in Prefab, make sure center is on and reexport as awd2. If you want to have some rotations set, export as obj all axis aligned, set the transforms in Prefab prior awd2 export.

   

Kodremus, Newbie
Posted: 26 October 2012 03:38 PM   Total Posts: 3   [ # 2 ]

Tried it out and it does work. Thanks!

I also found out that it also works if I export to AWD in 3dsMax and then import in Prefab with recenter on and then export into AWD again from there. So now with just an extra step I can get all of the positions of my meshes.

Thanks again.

   
   
‹‹ Mask 3D container

X

Away3D Forum

Member Login

Username

Password

Remember_me



X