How exactly does updateWorldTransforms() work?

Currently I’m in the process to find a bug I have in my code.

However currently I’m kinda stuck at this:

[java] void checkDoTransformUpdate(){

if (!this.refreshFlags){



System.out.println("Updating transform " + this.getName());

if (parent == null){

System.out.println("No parent " + this.getName());


refreshFlags = false;


System.out.println("parent " + this.getName());

Spatial[] stack = new Spatial[32]; // First of all do I understand this right that this basically means any scenegraph witha depth over 32 will fail? (Though not the bug I’m tracking)

Spatial rootNode = this;

int i = 0;

while (true){ // we search for the node thats the first without a transformrefresh set on the way to the rootnode here and delete all old worldtransforms here

Spatial hisParent = rootNode.parent;

if (hisParent == null){


rootNode.refreshFlags = false;




stack = rootNode;

if (!hisParent.refreshFlags){



rootNode = hisParent;



for (int j = i; j >= 0; j–){ // we update them from the found node down to our leaf

rootNode = stack[j];





Did I understand this right ? Because if at least I know i have somewhere else to dig further.

The whole point of localized transform update is to compute the world transform, so you want to find the highest node in the tree with an updated world transform, once you found it, you just combine the transforms until you reach the current node.

And yes you’re right about the 32 depth limit, but at the time of writing I didn’t feel like it was such a big issue. If you have such a deep scene graph you probably already have other problems, and besides the limit can be increased to any number you like.

Yes, still I feel kinda bad, to see that if I have a moving object the stack array is recreated every frame, woudn’t a static array do the same, but without object creation?

Also I feel like the 32 shouldn’t be hardcoded, it could be the default, but there should be the option to choose a size be aviable.

An array is not created every frame:


TempVars vars = TempVars.get();

assert vars.lock();

Spatial[] stack = vars.spatialStack;

Spatial rootNode = this;