Try MAXST AR Fusion Tracker Now ✨
List
How Scale Instant Tracking Object?
Posted Date: 2017-09-06 21:45     Edited Date: 2017-09-07 10:18     Writer: micrarriors

How i can scale the Instant Tracking object?

I try like this but it didnt work:

trackable = trackingResult.GetTrackable(0);

        Matrix4x4 matrix = trackable.GetPose();
                     
        matrix *= Matrix4x4.Translate(new Vector3(0, pos.y, pos.z));
        matrix *= MatrixUtils.MatrixFromQuaternion(Quaternion.Euler(new Vector3(rot.x, 0, rot.z)));
        matrix *= Matrix4x4.Scale(scale);
        
        instantTrackable.OnTrackSuccess(trackable.GetId(), trackable.GetName(), matrix);

Posted Date: 2017-09-07 10:18     Edited Date: 2017-09-07 10:18     Writer: admin

Hello.

 

Tested with the code below, the scale was converted without any problems.

Trackable trackable = trackingResult.GetTrackable(0);
Matrix4x4 matrix = trackable.GetPose();

Matrix4x4 translation = Matrix4x4.identity;
Matrix4x4 orientationMatrix = Matrix4x4.identity;
Quaternion orientationQuaternion = Quaternion.identity;

orientationQuaternion.eulerAngles = new Vector3(0, 0, rotationDegree);
orientationMatrix = MatrixUtils.MatrixFromQuaternion(orientationQuaternion);
translation.m03 = positionX;
translation.m13 = positionY;
matrix *= translation;
matrix *= orientationMatrix;
matrix *= Matrix4x4.Scale(new Vector3(3.0f, 3.0f, 3.0f)); << add!!

instantTrackable.OnTrackSuccess(trackable.GetId(), trackable.GetName(), matrix);

If you have any more questions, please feel free to ask.

Best regards,
MAXST SDK team