Problems with “recenter”

Software: Away3D 4.x

Alex Bogartz, Sr. Member
Posted: 09 March 2012 03:24 AM   Total Posts: 216

I am loading a 3DS model exported from Blender with all transforms applied.  When loaded in Away3D, everything looks correct and is correctly placed.  I am loading the resulting mesh into a holder mesh called “sceneContainer”.

There is one mesh I want to rotate with code, but the resulting pivot point is in the center of the scene, not the center of the mesh.  Using MeshHelper.recenter sends the mesh far off into space(I can’t even see it anymore) even though I say “keep position”.  Is there a working example of MeshHelper.recenter or has anyone gotten it to work?

What’s the right way to use it?  Is it because it’s a mesh inside a mesh?

   

Avatar
Fabrice Closier, Administrator
Posted: 09 March 2012 10:57 AM   Total Posts: 1265   [ # 1 ]

Can you update your away copy from git, I have just pushed an update that should fix the recenter issue.

   

Alex Bogartz, Sr. Member
Posted: 09 March 2012 04:15 PM   Total Posts: 216   [ # 2 ]

Sorry, it’s still seeing the problem.  I just grabbed the latest file and compiled so I didn’t have a chance to investigate, but the mesh is definitely still offsetting far away.

Question: Would scaling matter?  I’m scaling up the “scene” mesh when it loads by 3.

I can send you my model offline if that would help.  I know the recenter issue has been popping up for different users so it’d be nice to get that dialed in.

   

Avatar
loth, Sr. Member
Posted: 09 March 2012 04:58 PM   Total Posts: 236   [ # 3 ]

you can change pivot
simply create a new Mesh
and add a clone of you model in

you can also use Mesh.geometry.
and transformation matrix

   

Alex Bogartz, Sr. Member
Posted: 09 March 2012 05:03 PM   Total Posts: 216   [ # 4 ]

Thanks, Loth.  I’m trying to avoid hacking it because the recenter function is very useful.

Here’s some more data:  by NOT scaling the mesh when it loads, recenter works correctly.  The offset is being multiplied by the amount of scale, I think?  Still debugging….

   

Avatar
loth, Sr. Member
Posted: 09 March 2012 05:11 PM   Total Posts: 236   [ # 5 ]

you can resize object after loading like
Mesh.geometry.scale(x) (i use this for physics triangleMesh)
or Mesh.scale(x)

   

Alex Bogartz, Sr. Member
Posted: 09 March 2012 05:15 PM   Total Posts: 216   [ # 6 ]

Same issue.  Any scaling throws off the recenter function.

   

Avatar
Fabrice Closier, Administrator
Posted: 09 March 2012 09:17 PM   Total Posts: 1265   [ # 7 ]

K, will take a look at it. It works fine into Prefab. May be because I take care of this scaling issue somewhere else. Or most likely, I’ve simply forgot to push more fixes I’ve found while busy with it. I’m on something else atm, but will come to it asap.

@alex I’m trying to avoid hacking it because the recenter function is very useful.
The kind of remarks that I like smile

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X