Problems with axis

I have created a mesh which is the son of another mesh. After that I need to rotate the first mesh to put it in the way I want to.
The problem I find is that the y and z axis seem to have the same direction because when I gave it values It rotates in the same direction but in diferent sense.
I can’t attach a playground because I’m writing the code in VSC and it too much conected with other files.
Has someone had the same problem?

I cannot say that I completely understand your problem. How do you rotate your mesh? With rotation or with rotationQuaternion?
Even a simple PG would help a lot to help you, otherwise we’ll need to guess about your code.

2 Likes

I’m using rotation. I attach some screenshot of my code



As you request I attach a playground with a recreation of my code (I’m having some problems with PI)

Check out this.
transform = new BABYLON.TransformNode("root");

Thats how I attached things meshes togethers with the camera and player.
Example:
playerCamera.parent = transform;

1 Like

You need to remove ‘BABYLON’ from your declaration for this part when using the PG.

Same as @labris, I’m also not sure to understand your question and problem. Which part is it you want to rotate and what is it that is not working as you expect?

Math.PI relates to radians.
If you want to use degrees (which could be more convenient and readable) you may use

BABYLON.Tools.ToRadians(180)

(or any needed degree)

As I expected, when I do it in the PG it works as it was supposed. However, in VSC I still have the problem.
I attach a few screenshots so you can understand my problem



As you can see in the first one I have put the excat same rotation vector 3 than in the PG. However, A different result appear. And when I try to rotate in the other direction it rotate in the same direction but with diferent rotation. So my problem is that I can’t rotate the blade in its longitudinal axis.

Not sure that I understood you completely, but could you try to make rotation as (values are just example):

mesh.rotation.x = Math.PI
mesh.rotation.y = 0
mesh.rotation.z = 0

Sorry, I’m also not sure to understand quite exactly. May be a matter of language, is it?
You might be facing a left vs right-handed issue? Comparing your screenshots with the PG, it seems your ‘pala’ is offseted left from the ‘cabeza’ in the PG but offseted right from it in your screenshots.
And when you say “rotate in the other direction”, do you mean that in the PG, a y-rotation makes it rotate ‘counterclock wise’ and in your project it would rotate ‘clockwise’, is that what it is?

Edit: Look at this PG below where I changed your scene to a ‘right-handed system’.
Does this match what you have in your project?

Edit1: From the above PG you should disregard the pala extrusion. The extrusion must have been done to match your project coordinates (I believe). If, as I think, you are facing an issue with mixing left and right system coordinates, the extrusion in BJS needs to be done using the left-handed system OR if you choose to go with the right-handed system, the extrusion needs to use these coordinates. In the below PG, I translated the values just quickly for a check. Now, would you say that this PG matches what you have in project?