The easiest way to create a fixed axes without ORTHOGRAPHIC_CAMERA?

Hello,
I am new to babylon.js.

First, I am trying to create a fixed size coordinate system in the bottom right of a scene, refer to this topic,
How to get X,Y and Z labels attached to axes? - Questions - Babylon.js (babylonjs.com)
However, I found that the model cannot transform bigger or smaller, due to the camera mode is ORTHOGRAPHIC_CAMERA I guess?
So, I tried to change the camera mode, this is my pg: glTF Loader Demo | Babylon.js Playground (babylonjs.com)
but I found that the axis was a little transformed and were not perpendicular to each other?
Is there any way to solve this problem, by making a fixed not transformed axes and can also change the size of the model?
Do I need to draw the axes using CreateLines?

Welcome aboard!

You could try to use an additional orthographic camera that would only render the axis viewer:

It gets the quaternion from the scene camera and uses it to correctly transform the axis of the axis viewer.

2 Likes

Tks a lot, solved my problem. Still need some time to figure out how this works though :rofl:

Note that the multiplication by quatX / quatY for the x/y axes is due to the fact that there is a default rotation for these two axes in the AxisViewer class, and that we must therefore take them into account.

Sorry to bother, I am trying to add a pick mesh function based on this pg glTF Loader Demo | Babylon.js Playground (babylonjs.com)
Line 19, I added:
scene.onPointerDown = function (evt, pickResult) { console.log('pickResult', pickResult) };
But it does not work, I am guessing that the axisCamera blocked the mesh?
Is there any solutions? :rofl:

You need to set scene.cameraToUseForPointers with the first camera, else the system is using the last camera of scene.activeCameras by default for pointer events:

Amazing! Thanks again :smile:

I was trying use this PG to create fixed axis, it is useful, and success;
In addition I need add dynamic texture (x,y,z) in the axis , when I add texture on the axis and rotate the scene, the text label is static not follow the axis to rotate ; how can I let the texture label follow the axis to rotate; I need help

I think you should create a new thread with a reproduction in the playground, so that people will be able to help you.

you mean I should copy my code to the playground , and let people help me ?

I am a fresh man of babylon js, so what should I do

Yes, create a new topic in Questions - Babylon.js about your problem, and provide as simple a reproduction as possible in http://playground.babylonjs.com/. This way, people will be able to help you more effectively.