I wanna use “LookAt” for a LineMesh, but i does not work like for a Box (both MeshBuilder).
Am i wrong or is it a bug?
“linesystem” should “look” upwards (0, 1, 0) but it still looking forward…
Or any other idea how i can make this work?
Thx for your help!
I think the issue is that your line mesh’s “facing” direction mathematically isn’t the same as the direction it intuitively looks like it should be facing based on its shape. If you comment out lines 67 and 71, you can see that with no rotation applied, the box’s long axis isn’t aligned with the camera shape’s “forward” axis. However, the long axis of the box is aligned with Babylon’s notion of “forward” — the Z axis — whereas the camera shape is “facing” down -X, not Z. I can think of two straightforward ways to solve this. The better but slightly more difficult approach is to redraw the shape to match its intuitive “forward” axis with the Z axis (for every point in the shape,
(x, y, z) →
(-y, x, z)). The other, probably easier alternative is to just rotate the line mesh to be “facing” down Z, parent it to a
TransformNode with no rotation on it, then manipulate the
TransformNode instead of the line mesh.
Hope this helps, and best of luck!
thx a lot for you advice!
I’ve redrawn the line mesh regarding the intuitive “forward” axis:
This helped! Thank you!