www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: cintix on November 13, 2011, 07:29:29 pm

Title: Difference in position when building object and not builing them
Post by: cintix 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 ??



Title: Re: Difference in position when building object and not builing them
Post by: EgonOlsen 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.
Title: Re: Difference in position when building object and not builing them
Post by: cintix 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 :-)