Add the DragControls to a dynamically created Cube

so without the annotation THREE won’t be able to access the parent, or the object in this case?

by user 367081956959322114

Without the annotation you wouldnt get the reference to your object.

For example this is without the annotation
unknown.png
unknown.png

and this is the same with the annotation - we resolve that using a gltf Extension during the loading process
unknown.png
unknown.png

we find the node 36 (or better yet the object that is created from that node 36) and assign it to your script instance

wow I see, nice!

by user 367081956959322114

this should actually work right?

I use a emptyObject (or a cube in unity) as placeholder to add the new cubes there


by user 367081956959322114

Alert.ts:27 Uncaught ReferenceError: allCubes is not defined

by user 367081956959322114

at the time when I do onPointerClick, allCubes shouldn’t be undefined

by user 367081956959322114

the error is in line 27 tho - what is in line 27?

(you would also have to access it using this.allCubes)

line 27 is acutally allCubes.add(cube); // I rearanged the code for the screenshot…

by user 367081956959322114

oh yeah… sure… it should be THIS.allCubes

by user 367081956959322114

Marcel… thank you… and sorry for this.

by user 367081956959322114

Don’t be sorry for this :smirk:

all good :slightly_smiling_face:

haha

by user 367081956959322114

xD

by user 367081956959322114