I actually made an easy workaround, but I'm just curious. I don't exactly understand what .clone() does under the hood.
I created this class to normalize vectors
class Vector {
  constructor(x,y){
    this.x = x
    this.y = y
  }
  normalize() {
    let length = Math.sqrt(this.x * this.x + this.y * this.y)
      this.x = this.x / length
      this.y = this.y / length
  }
}
I then import a GLTF model (simplified code):
const loader = new GLTFLoader();
loader.load( './assets/models/ROCKS.glb', function ( glb ) {
glb.scene.userData.mouseDirVector = new Vector(0,0)
obj = glb.scene
obj2 = obj.clone()
}
But later in code, when I try to use the Vector object's .normalize() method, I get an error (only on the cloned object):
Uncaught TypeError: obj2.userData.mouseDirVector.normalize is not a function
Why is it happening?
 
     
    