# Is ThreeJS object hierarchy documented anywhere?

**URL:** <https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [June 17, 2019, 6:31pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139 "2019-06-17T18:31:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultralowpoly](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ultralowpoly](https://discourse.threejs.org/u/ultralowpoly)\
**Post date:** [June 17, 2019, 6:31pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/1 "2019-06-17T18:31:07Z")

</div>

Hello,

I am using the code below but position is not a recognized property of :

```auto
geometry = new THREE.PlaneBufferGeometry(2000, 2000, 200 - 1, 200 - 1);
geometry.attributes.position.needsUpdate = true;

```

I probably need to cast geometry or geometry.attributes into something else like:  
(\<SomeClass?\>geometry).attributes.position.needsUpdate = true;  
or  
(\<SomeClass?\>geometry.attributes).position.needsUpdate = true;

but I cannot figure what Class or Interface to use for SomeClass.

It would be really nice to have the ability to filter ThreeJS classes on the search based on existence of a property or method.

Last but not least is ThreeJS object hierarchy documented as a hierarchy diagram or an expanded explorer view, anywhere?

---

<div class="post-metadata">

**Author:** ![marquizzo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/marquizzo/32/25192_2.png) [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Post date:** [June 17, 2019, 7:14pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/2 "2019-06-17T19:14:46Z")

</div>

Not sure why you’re setting `needsUpdate` to true right after creating the geometry. It doesn’t need that upon creation, only after you’ve made changes to the values in the position array.

> I probably need to cast geometry or geometry.attributes into something else

What makes you say that? Are you getting any errors or undesired behavior? Also, you didn’t mention it, but it looks like you’re using TypeScript, correct?

To answer your question, there is no hierarchy outline in the docs that I know of, but you can follow the hierarchy by looking at the top link of each page. [PlaneBufferGeometry](https://threejs.org/docs/index.html#api/en/geometries/PlaneBufferGeometry) is a subclass of [BufferGeometry](https://threejs.org/docs/index.html#api/en/core/BufferGeometry), which has a [.getAttribute](https://threejs.org/docs/index.html#api/en/core/BufferGeometry.getAttribute) method, which gives you a [BufferAttribute](https://threejs.org/docs/index.html#api/en/core/BufferAttribute) object. You should probably use `.getAttribute("position")` instead of directly accessing `.attributes`.

---

<div class="post-metadata">

**Author:** ![ultralowpoly](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ultralowpoly](https://discourse.threejs.org/u/ultralowpoly)\
**Post date:** [June 17, 2019, 8:04pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/3 "2019-06-17T20:04:26Z")

</div>

@marquizzo  
I am using r104 and yes project is in TypeScript.  
About the two lines above you are correct those are not side by side.  
Instantiation (1st line) is done in constructor while the update to .needsUpdate (2nd line) is in fact done in a render loop where a function updates the position of all vertices of the PlaneBufferGeometry.

Two of the properties are not recognized even though they exist on the underlying JS Object, here are the errors:  
Error:(30, 48) TS2339: Property ‘dynamic’ does not exist on type ‘BufferAttribute | InterleavedBufferAttribute’.  
Property ‘dynamic’ does not exist on type ‘InterleavedBufferAttribute’.

Error:(56, 48) TS2339: Property ‘needsUpdate’ does not exist on type ‘BufferAttribute | InterleavedBufferAttribute’.  
Property ‘needsUpdate’ does not exist on type ‘InterleavedBufferAttribute’.

Thanks for the reply

---

<div class="post-metadata">

**Author:** ![marquizzo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/marquizzo/32/25192_2.png) [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Post date:** [June 17, 2019, 8:11pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/4 "2019-06-17T20:11:46Z")

</div>

Did you try using  
`geometry.getAttribute("position").needsUpdate` instead of  
`geometry.attributes.position.needsUpdate`?  
The docs recommend against [accessing the `.attributes` property directly](https://threejs.org/docs/index.html#api/en/core/BufferGeometry.attributes)

---

<div class="post-metadata">

**Author:** ![ultralowpoly](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ultralowpoly](https://discourse.threejs.org/u/ultralowpoly)\
**Post date:** [June 17, 2019, 8:35pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/5 "2019-06-17T20:35:37Z")

</div>

Using TS to code, I am following an example at:  
[threejs.org/examples/?q=dynam#webgl\_geometry\_dynamic](http://threejs.org/examples/?q=dynam#webgl_geometry_dynamic)

I tried your suggestion like that but same result:

```
let position:THREE.BufferAttribute|THREE.InterleavedBufferAttribute = this.geometry.getAttribute("position");
console.log(position);
position.dynamic = true; //Error still

```

dynamic field does exist as shown below:  
 ![dynamic-exist](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/f/f34d228e04c43c4b904963b81a1cb6213b038ccf.jpeg)

---

<div class="post-metadata">

**Author:** ![marquizzo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/marquizzo/32/25192_2.png) [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Post date:** [June 17, 2019, 8:42pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/6 "2019-06-17T20:42:35Z")

</div>

`.dynamic` does not exist in an `InterleavedBufferAttribute`, only in a `BufferAttribute`. So if you’re saying it could be both, the compiler errs in the side of caution and decides to not allow it.

If you do a bit of [type-assertion](https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions), you can tell the compiler that you know it’s going to be a `BufferAttribute` for certain:

```auto
let pos = (<THREE.BufferAttribute>this.geometry.getAttribute("position"));
pos.dynamic = true;

```

---

<div class="post-metadata">

**Author:** ![ultralowpoly](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ultralowpoly](https://discourse.threejs.org/u/ultralowpoly)\
**Post date:** [June 17, 2019, 9:01pm UTC](https://discourse.threejs.org/t/is-threejs-object-hierarchy-documented-anywhere/8139/7 "2019-06-17T21:01:15Z")

</div>

You are correct that was it!  
That compiler error finally went away, it was starting to get under my skin.  
I should have checked both classes, good to know for next time.  
The line below works great now.

`(<THREE.BufferAttribute>this.geometry.getAttribute("position")).needsUpdate = true;`

Many thanks!!!
