# Setting position now requires setting \_isDirty to true..?

**URL:** <https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286>\
**Category:** Questions\
**Created:** [March 10, 2022, 4:09am UTC](https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286 "2022-03-10T04:09:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaderbytes](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shaderbytes/32/174_2.png) [@shaderbytes](https://forum.babylonjs.com/u/shaderbytes)\
**Post date:** [March 10, 2022, 4:09am UTC](https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286/1 "2022-03-10T04:09:43Z")

</div>

Hi all,

So I had to update my project to the most recent babylon engine to hopefully get around some ios bugs , anyway ( Babylon.js v4.2.1 - WebGL2 - Parallel shader compilation )

I found that there is an issue in my project now with changing transform properties.

This was previously working as is, in that I am creating some transform variants for nodes which could have any of the TRS Vector3 objects. (i only use the ones i need )

Then in the application when a specific scene requirement is met and it calls for a node transform to be updated , i am then getting a reference to these vector3 objects and then just setting the nodes position , rotation and scale ( where applicable )

one such stored node transform is stored under the key DEFAULT. I use this to just reset a transform to any of its starting values.

eg…

```auto
if (a.requiresTransformReset) {

            a.requiresTransformReset = false;

            //set to default transform

            var t = a.collectionTransforms.DEFAULT;

                     

            if (t.location !== null && t.location !== undefined) {

              a.node.position = t.location;

              t.location._isDirty = true;

            }

            if (t.rotation !== null && t.rotation !== undefined) {

              a.node.rotation = t.rotation;

            }

            if (t.scaling !== null && t.scaling !== undefined) {

              a.node.scaling = t.scaling;

            }

          }

```

this worked before but stopped working and I traced it down to a variable in the vector3 named \_isDirty  
if I manually set this to true ( as can now be seen in the code above ), then it works.

but based on the fact it is a underscored field and not a setter is telling me this is technically not something I should be setting manually , i did not see a setter for it. Did something get missed here?

Seems I can set the scale back and forth just fine without changing the isDirty prop … but not position.

well I get to do one change actually , its the second change that fails without setting this \_isDirty prop to true manually

the assets are loaded at runtime with BABYLON.SceneLoader.ImportMesh

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [March 10, 2022, 11:26am UTC](https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286/2 "2022-03-10T11:26:26Z")

</div>

it does depend on what exactly you are trying to achieve, but if I may suggest a better solution - instead of replacing the position with a new variable, can you try using the `copyFrom` function to copy the values of the new vector to the already existing one? Your garbage collecter will thank you, your code will be a bit mroe optimized, and (I believe) your issue will be resolved.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 10, 2022, 5:23pm UTC](https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286/3 "2022-03-10T17:23:47Z")

</div>

Swapping a node position should work but there is definitely an issue there… [https://playground.babylonjs.com/#6CCHQX#2](https://playground.babylonjs.com/#6CCHQX#2) @RaananW can you have a look ? or I ll dig in today ?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 10, 2022, 5:29pm UTC](https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286/4 "2022-03-10T17:29:36Z")

</div>

Scratch that, actually @Deltakosh is checking 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 10, 2022, 5:51pm UTC](https://forum.babylonjs.com/t/setting-position-now-requires-setting-isdirty-to-true/28286/5 "2022-03-10T17:51:40Z")

</div>

Will be fixed by the Babylon Daddy himself here: [Fix cache issue when parenting by deltakosh · Pull Request #12138 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/12138)
