Remove the readonly flag on position of Object3D?


I’d like to open discussion about the necessity of removing the possibility to change an Object3D position’s Vector.

Currently, it does not seem to change anything if ‘position’ is replaced by another Vector3 object during the lifetime of an Object3D. Quaternion and rotation which depend on each other and the Object3D constructor define event handlers on them, so I understand why these should not change.

Now, why would I want to be able to change it? We are implementing a “memory-backed Vector3”. This Vector3 has getters and setters that are interacting with a TypedArray. We are using the TypedArray for faster physics, sharing it would ultimately allow for parellel physics computing in WebAssembly.

How does that sound to more experienced ThreeJS users? Does our usecase seem like a viable idea? Did we miss some impact that could have changing the value of the ‘position’ property?

Hey @Salketer thanks for your post!

A similar discussion of this issue exists here: API Design: Object3D.position is read-only · Issue #8940 · mrdoob/three.js · GitHub

Not just position. Matrices would be very useful if they could be just referenced.