Jump to content

[Solved] mesh.getAbsolutePosition() -> { x: NaN, y: NaN, z: NaN }


stormwarestudios
 Share

Recommended Posts

Hello!

Your first question may very well be, "Peter, what in the nine hells did you do?" and so for this I will try to explain!

While building up my scene, I happened upon a situation where a mesh that I expected to be present, was absent in the rendered viewport.

After visual inspection with the debugLayer, the object was truly in the scene, but simply not visible.

Upon calling mesh.getAbsolutePosition(), I was shocked to see the return value of { x: NaN, y: NaN, z: NaN }

What is odd about this particular situation is that the mesh is one of 10 that are generated in a loop; the others are fine and appear as expected, but my missing mesh (#3 in the list) is visually not appearing.

I broke down my code to determine where this might be occurring, and it seems that, until the following call, the absolute position of the entity resolves to { x: 0, y: 0, z: 0 } (as expected)... once the call is made, the absolute position of the mesh appears as { x: NaN, y: NaN, z: NaN }  !

engine.runRenderLoop(this._runRenderLoop.bind(this));

It would be difficult for me to explain in code how things are set up, so I'm hoping that someone might have encountered such a situation and be able to say, "hey, I know what in the nine hells *I* did, so here are my experiences and how I fixed it!"

Regardless of the outcome, I will try to explain my solution when I come across it. :D

Thanks for reading!

- Peter

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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