[SOLVED]Rotation from Axis to get Local Coordinate for Lines

I try to use BABYLON.Vector3.RotationFromAxis(tangent, norm , binorm) to show local coordinate system of a line which is along a vector. As an example, a line along a vector (1,0,0) should have exactly the same coordinate system for local. I couldn’t get the same result. See below.


I am use a right-handed system and the issue exists for left-handed as well. I don’t know what went wrong here. Thanks!

Update: I think I no longer need an answer on this. What I did is just rotating the axis around the line for 90 degrees. There is no unique solution for local coordinates for a line. It seems a rotation of 90 degrees just brings the local y axis on the higher side.

Adding @bghgary who played a lot with those :slight_smile:

Thanks! I edited the question to make it more specific; also created a playground example.

Looks like you’ve already figured it out. :slight_smile: Let us know if you need further help.

Hi, @bghgary,
I worked it out by rotating the axis toward the direction I intended to have; there is no unique solution for the local coordinates of a line. Thanks! You guys are awesome!!

1 Like