transformNode positioning baking?

I have a situation like this:

 zone.node.setPositionWithLocalVector(zone.node.position.subtract(wompm))
 zone.node.translate(Vec3.Zero(), 0); //bakes transform (??)

Without the .translate(), which does nothing (something), .setPositionWithLocalVector() doesn’t take.

Anyone know quick offhand how to do this better or what might be happening? ty <3

This works

    const tr = new BABYLON.TransformNode("tr")
    tr.setPositionWithLocalVector(BABYLON.Vector3.Up()) // 0, 1, 0

Example - Babylon.js Playground

Something is happening with zone.node.position.subtract(wompm). What does it return?

Another example with mysterious wompm test :slight_smile: - https://playground.babylonjs.com/#EUU1IO#1

1 Like

This is fun, and how I got here,

        // log(zone.node.getAbsolutePosition())

also successfully alters the situation in the same manner as:

zone.node.translate(Vec3.Zero(), 0); //bakes transform (??)

, making the downstream result (an off-by-one misplacement on the z-axis [only]) run correctly.

The .position logs the expected results in both cases. But whatever is downstream sees some discrepancy… Maybe a loose reference, but very odd to me

Make sure you have correct variables all the way down :slight_smile:

I have been all over it and just touching it after the translation fixes it. X.X

..and it only bugs on z x.x

This doesn’t feel like my fault I swear, as Much as I trust labris not to steer me wrong.

What ‘variables all the way down’ are there T_T

I mean that if the code works with known and defined variables it may give errors when variables are not defined or pass wrong parameters.

I’m distraught, @labris.

No reason to be sad, your initial code works and this is already always great :slight_smile:

zone.node.setPositionWithLocalVector(zone.node.position.subtract(wompm))
 zone.node.translate(Vec3.Zero(), 0); 

i hate everything about it