Rolento Posted October 28, 2016 Share Posted October 28, 2016 Hi All I am trying to create an algorithm that dynamically draws a line (connector) that links a label to a shape. At the moment I have a function for rendering a label at the location a shape resides. Prior to rendeirng the connectors I wanted to resolve the issue of overlapping labels - i.e. dependent on the orientation of the camera the labels will overlap because the 2D X/Y screen coordinates projection occupies the same space. In my attempt to fix this problem I wanted to obtain the X/Y screen coordinate for the shapes in my scene - I am using the following code: var p = BABYLON.Vector3.Project(mesh.position, BABYLON.Matrix.Identity(), scene.getTransformMatrix(), camera.viewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight())); The problem I am finding is that the position returned has an X and Y coordinate of NaN. I dont understand why this is happening and was hoping someone could kindly take a quick peak at my code to determine whats up: http://www.babylonjs-playground.com/#1B1LNW#2 * See lines 154 ~ 158 for the above code snipplet Beyond fixing the bug as reported above, if anyone can provide pointers as to how best resolve the overlapping labels issue that would be great. Ideally I want all connectors to follow a uniform pattern / pathlinking labels to their corresponding shape. Anyway, any pointers would be appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
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.