BaseDraw scale
-
Hello,
Drawing my BaseObject gizmos on the viewport with BaseDraw, using it's matrix, the drawn elements are also drawn in the same scale of the matrix. This looks very weird on my objects, I prefer them to be unscaled. Is there something I can do besides altering each drawn coordinate?
This is how I'm setting the matrix:
bd->SetMatrix_Matrix( op, op->GetMg() );
Multiplying the matrix by the inverse scale matrix will not work, the drawn elements will be unscaled but in the wrong position.
-
Hi @rsodre thanks for reaching out us.
With regard to your question I think you have to separate from the global transformation matrix the scaling part and create an inverted scale transformation matrix to compose with your gizmos's transformation matrix to get rid of the scale.
... // given a generic BaseObject get its global transformation const maxon::Matrix fullTransformation = obj->GetMg(); const maxon::Vec3<maxon::Float> scaleVector = fullTransformation.sqmat.GetScale(); const maxon::Vec3<maxon::Float> inverseScaleVector = maxon::Vec3<maxon::Float>(1/scaleVector[0], 1/scaleVector[1], 1/scaleVector[2]); const maxon::Matrix inverseScaleTransformation (maxon::Vec3<maxon::Float>(0, 0, 0), maxon::GetScaleMatrix(inverseScaleVector)); // use this inverse-scale transformation to compensate gizmo scale ...
Let me know if it works as expected.
Cheers, -
@r_gigante Thanks, I used an inverse scale matrix wen calculating my gizmo points.