Author Topic: Difference in position when building object and not builing them  (Read 1688 times)

Offline cintix

  • byte
  • *
  • Posts: 28
    • View Profile
Difference in position when building object and not builing them
« on: November 13, 2011, 07:29:29 pm »
Hi agian,

In my little test I loading 3 rather simple 3DS models.
I created them in one project and exported them one by one, so when I loaded them. They would be placed correctly just by loading them.
This worked great until i noticed that I did not call world.buildAllObjects(), and I thought that might be a good idea to get better performance.

Then after building all object then the models gets a placed wrong. NOT all wrong but the Y axis is of like 69 and 56 on another object.
Have anyone of you had this problem ??



Faith is for the weak...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Difference in position when building object and not builing them
« Reply #1 on: November 13, 2011, 08:44:36 pm »
build() does nothing to the objects geometry. However, it does something to the rotation pivot, i.e. it calculates a new one. Without build(), the pivot is at (0,0,0). Try to build the objects (you are not supposed to omit this call, because otherwise, no normals and no bounding box are present) and reset the rotation pivor to (0,0,0) afterwards to see if that helps.

Offline cintix

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Difference in position when building object and not builing them
« Reply #2 on: November 13, 2011, 09:10:15 pm »
Ohh thank you agian..
using  object3D.setRotationPivot(new SimpleVector(0,0,0)); after doing world build fixed everything :-)
Faith is for the weak...