Hi everyone. I just started using the framework and am absolutely loving it. Thanks a lot.
Also, I’m a newbie and while I Don’t understand a lot I have been able to achieve a lot of stuff due to Babylon js.
The problem I’m running into is basically this.
I’m making a custom mesh of a human face by feeding in vertices, indices, computing normal and calculating uvs as specified here : https://doc.babylonjs.com/how_to/custom
All of this is being done in the runtime.
Then I have an arc rotate camera and a spotlight whose direction is set to the centre of bounding box of mesh.
The issue is that the mesh so formed is upside down, i.e. mouth is up and eyes are down.
How do I fix this?
Everytime I try to rotate it the mesh goes outside the canvas.
Can you please help me regarding this without a PG. I understand a PG would make stuff easy on your part but it’s not possible for me to provide it.
And all I want is a way to rotate the mesh about the centre of its bounding box in order to make the rendered mesh straight up.
For maestros who lurk here this should be too easy to answer.
Rotation shouldn’t change the position of the pivot.
The absolute position of the child mesh(your head), may change depending on its own pivot in relation to the pivot of the … pivot.
Changing the position After setting the parent, as I did above, is equal to using setParent(x).
Are you sure the boundingBox information isn’t altered? When are you checking the boundingBox?
You should check it the next frame, as it will have updated by then. If you need it immediately, you’ll have to call head.computeWorldMatrix(true) to forcefully and manually update it.
Hi @Noob007 and welcome to the forum from me. A couple of pointers for future reference that are hopefully helpful.
While providing full code in a PG is often difficult and occasionally impossible it is nearly always possible to produce one illustrating the issue. In your case the issue is producing a custom mesh that is upside down with reference to the camera. So a simple triangle would suffice eg
Then we can show example solutions that may also work for you.
since you are creating a custom mesh multiply all y components by -1 and to keep normal direction for each set of three index value in indices for a tringular facet swap two.
OR
2. Invert the upVector for your camera y direction and change scene to right handed system