How to calculate orientation matrix
I have a 3d cylinder that represents 3d line. I need to calculate transform matrix which orient cylinder in the direction of the line. I tried with Matrix.setLookAtM:
val lookAt=FloatArray(16)
Matrix.setIdentityM(lookAt,0)
val delta=-(end.position-start.position).normalized
var up=Vector3(0f,1f,0f)
Matrix.setLookAtM(lookAt,0,delta.x,delta.y,delta.z,0f,0f,0f,up.x,up.y,up.z)
Unfortunately setLookAtM gets matrix with NaN values when delta=up
Is there way to get orientation matrix without such...