Quantcast
Channel: Bugs Latest Topics
Viewing all articles
Browse latest Browse all 760

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

$
0
0

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


Viewing all articles
Browse latest Browse all 760

Trending Articles