# Why does TransformNode constructor have \`scene\` and \`isPure\` parameters?

**URL:** <https://forum.babylonjs.com/t/why-does-transformnode-constructor-have-scene-and-ispure-parameters/42767>\
**Category:** Questions\
**Created:** [July 28, 2023, 4:58am UTC](https://forum.babylonjs.com/t/why-does-transformnode-constructor-have-scene-and-ispure-parameters/42767 "2023-07-28T04:58:26Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![trusktr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trusktr/32/840_2.png) [@trusktr](https://forum.babylonjs.com/u/trusktr)\
**Post date:** [July 28, 2023, 7:56pm UTC](https://forum.babylonjs.com/t/why-does-transformnode-constructor-have-scene-and-ispure-parameters/42767/12 "2023-07-28T19:56:37Z")

</div>

> [@Joe\_Kerr](#):
>
> re “optional”: [Default parameters - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)

I know JavaScript well, but it isn’t obvious why the parameters are optional (the API docs don’t really say). Why give a node a scene? And why not give a node a scene?

> [@Joe\_Kerr](#):
>
> re “Why do all objects in Babylon need a scene?” This is a wrong statement. The objects in question give the **option** to provide a scene.

They seem to be required: if you don’t provide it yourself, then Babylon goes and gets the `LastCreatedScene`, so no matter what, every node is apparently required to have a scene (just not always provided by the constructor).

But even so, I tried previous examples (above), including creating a new scene before making new TransformNodes without specifying scenes for them, which supposedly means they should get the `LastCreatedScene` that I made, yet the examples work the same, so I don’t get what the difference is. Either that, or there’s really a difference and it has caused some sort of weird memory leak where nodes are used in one scene but state is stored for them in the second scene. Its confusing, and means I’d have to really dig deep into the code to understand if I’m shooting myself in the foot or not.

> [@mawa](#):
>
> That’s from a pure dev’s perspective, is it?

Yes indeed, I’m writing code with Babylon, and was referring to the software developer experience.

PlayCanvas has a UI out of the box, just log in and jump right in to the full editor (more like Unity/Unreal than Babylon it seems to me), and f.e. see the docs on the [visual node-based material editor](https://developer.playcanvas.com/zh/shader-editor/introduction/). Besides having this, PlayCanvas code is clean.

As an example, in Three.js and PlayCanvas it has turned out to be way easier than in Babylon to [load an asset into a particular node in a scene graph](https://forum.babylonjs.com/t/loading-babylon-scene-as-a-child-of-a-specific-scene-graph-node/42328/12). I’m surprised at how difficult it is to do some simple things in Babylon. I find the code to be a bit disorganized compared even to JS libs in general, while Three.js is very well organized compared to JS libs of any kind (not just 3D libs).

These are just my opinions and thoughts. No offense intended to anyone. I hope contributors might see this and have a desire to simplify Babylon, as competition benefits everyone (even the non-Babylon users).

---

_[View the full topic](https://forum.babylonjs.com/t/why-does-transformnode-constructor-have-scene-and-ispure-parameters/42767)._
