Hi,
I dont’ really understand what is happening . I am trying to compute matrix, and for unknown reason, I don’t get expected results:
const origin = new TransformNode("orig");
origin.position.x = 5;
const frameOrigin = origin.computeWorldMatrix(true);
const A = new TransformNode("A");
A.parent = origin;
A.position.x = 25;
const frameA = A.computeWorldMatrix(true);
const B = new TransformNode("B");
B.parent = A;
B.position.x = 2;
const frameB = B.computeWorldMatrix(true);
console.log("mat B Tx +32", frameB);
result : !!! Tx is negative in the matrix and gives wrong result => -32 !
Hi, I don’t notice a problem, getTranslation
returns (32, 0, 0)
, as expected (see console in attached playground)
I really don’t understand. I copied elsewhere the code, same result…
this is a typescript project. version babylonjs 6.45.1
I think I found the issue. I had duplicated creation of transformnodes with same names.
No, … I have again negative value …
euh…looks like these are not homogenous matrix as I think.
There are impacted by camera I think.
This is very boring , since I want to retrieve frame matrix and make some robotics computations.
I would need to convert coordinates of points in some other transformnodes local spaces
Maybe at some point in your code you call invert() on the matrix ? It works in place, and I’m not sure the web console evaluate the matrix element before you unroll it.
Maybe try to log frameB._m.toString() ? So you’re sure it has not been changed after the log.
No, I checked .
What I am trying to achieve is similar to the ikbonecontroler , but I don’t want to use it for some reasons and use my own ik solver.
After I had a look at it. I found that the guy made a copy of all it s transformations matrix inside it s ik api instead of using babylonjs api matrix.
Regarding babylonjs implementation it makes sense…otherwise it is really a pain.
I really don’t understand why camera is coupled in world manipulation matrix !
I made something similar to IK solving here , without using built in IK solver, maybe that looks like your case.
I went knowing the length and direction of each limb part, and generating the appropriate position and rotationQuaternion for each limb part. I found it easier to understand than matrix multiplication.
If that’s helpful, the Leg code is here sumuqan/src/Leg.ts at main · SvenFrankson/sumuqan · GitHub , quaternion generation code is here mummu/src/Quaternion.ts at main · SvenFrankson/mummu · GitHub
1 Like
That is clean :-).
I understand, either implement another own class and matrix manipulations.
or switch to threejs , using threejs my work already works, but I have to stick it into a babylonjs project