Local position view or local position animation

3D file path : test_files/scene.glb at main · qkr7287/test_files · GitHub

  1. Is there a way to see Local Matrix or local position in the same form as Position(0,0,0)?
  2. “Animation” at “position.x” <= “local position.x” Is there a way to do it?
    Designing Animations | Babylon.js Documentation
  3. Finally, I want to move the local position with the Animation function…
  4. I want to see the local position in the form of new BABYLON.Vector3(0,0,0);

I have seen _localMatrix.getTranslation(); functions and have no knowledge of Matrix.
Is there anyone who can help me?

The position property of a mesh is in local space, so any animation that targets it is already doing it in local space. To get the world position of a mesh you can use absolutePosition. TransformNode | Babylon.js Documentation (babylonjs.com). You don’t need to use matrices directly.

2 Likes
  1. You can use the AxesViewer:
  1. I would recommend to pass correctly clamped (relative to world) key values. If you really can’t, then another solution might be to customize/clamp your interpolation-functions:
  1. The link of your second question should show how to do it.

  2. Either you simply use mesh.position/absolutePosition or evaluate animation values like in this PG or by Animatable.masterFrame:
    https://playground.babylonjs.com/#QYFDDP#606

This shows how to localize a global/absolute position-Vector3:

function localizePosition(position, mesh){
   return BABYLON.Vector3.TransformCoordinates(position, mesh.getWorldMatrix());		 
}

These links might help to get into matrices:

3 Likes

1.
If you look at “playground”, I moved “position.x” to “animation” for “models.mes[3]”,
Move to the right, unlike “pivot” in “models.mes[3]”, as shown in the picture above.
If you moved to a “local” coordinate system like “pivot,” you should move down, But it moved to the right… I don’t like it.
image

I want to move using “animation” based on “pivot” of “mesh”.
ex) Slide = new BABYLON.Animation(“xSlide”, “mesh.pivot.position.x Features such as…”, frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

For this, I moved the “pivot” and tried matching the “axis” that moved it.


image
Moved to “pivot Y Axis”.
However, in addition to “Absolute position X”, which is presumed to be “pivot Y Axis”, “Absolute position Y” among “Absolute position X,Y,Z”, also moved a little, so my discrimination was not accurate. Can I know about this?

The whole process is contained in “Playground.”

It’s important to note that imported GLTFs have a __root__ node that converts between a right-handed system in GLTF and a left handed system in Babylon. To make reasoning easier, I would recommend baking the root node in the objects themselves, so the local axis align to expectations: Baking transforms imported GLTF | Babylon.js Playground (babylonjs.com)

2 Likes

It’s a good way, but in my situation, I can’t change “Axis” in “Mesh”.
I can’t “bake” “Mesh Axis” because I have to create an animation that goes to “Mesh Axis Z” for every “Mesh”…

Can’t you recognize “Mesh Axis Z” and put it in Animation…?
ex) new BABYLON.Animation(“xSlide”, “position.x <= Mesh pivot Z”, frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);

I’m not very sure about what you mean :slight_smile: Do you want to move all of the meshes in the global Z axis? A drawing or diagram could be helpful here :slight_smile:

2 Likes

“global Z” and “mesh local Z” are different.

  1. I want to move to “Mesh Local Zaxis” using the “Animation” function.
  2. I want to know what axis “Mesh local X,Y,Z” is in “Global axis”.

Drawing??? Model is on github in the article above.
╯︿╰

The model is on github, but it’s not possible for me to understand exactly what are you trying to achieve here :upside_down_face:

1 Like

Currently, we manually check whether “local Mesh position.x axis” is “global position.x?y?z?axis”.

It’s easier if you work in a right handed system and modify the mesh’s hierarchy a bit so its parent has the rotation, not the mesh itself. Animation | Babylon.js Playground (babylonjs.com)

1 Like

Oh! Thank you!
Would it be difficult to implement the same without creating a “transnode”?

It’s much easier if you work with transform nodes, yes.

1 Like

Thank you so much for your help. It helped a lot!

1 Like