Jump to content

[Solved] SceneSerializer: rotation.asArray is not a function


Recommended Posts


I am trying to serialize the scene with


 and am getting a "mesh.rotation.asArray is not a function".

Serialization works fine when meshes are not rotated.

On further exploration, I realised that that mesh.rotation was not a Vector3 object but an object with getters, setters and __op__: Observer. Could this be the issue? 

Can you please help me fix this.

Please let me know if you need more details.

Thank you

Link to comment
Share on other sites

@Deltakosh Thanks for the prompt reply. For further illustration, I have added following code to your playground to produce updated playground


Note that both sphere.rotation and scene.meshes[0].rotation return Vector3 like objects with the following characteristics

  1. there are no getters and setters for x,y,z
  2. there is a method mesh.rotation.asArray()

However, when I execute console.log(scene.meshes[2].rotation) with my scene, I get an object with following

  1. there are getters and setters for x,y,z
  2. but no asArray() method.
  3. A property {__op__: Observer}. Do you know what kind of object this could be? 

I must mention that I doing this for meshes loaded in .obj format. Could loading .obj be responsible for this? Is there a way for me to add assets to playgrounds (so that I can demonstrate the error)?


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...