Calculate transform matrix

Hi,

I would like to compute the transform matrix that is generated when uploding a model to Cesium ion and georeferencing it by providing lat, long, elevation. Is it possible to compute this matrix using Cesium js?

I’ve tried using Transforms - Cesium Documentation but its not providing correction rotation only position is correct.

Definitly possible.

const longitude = 129.5089;
const latitude = 42.8913;
const height = 100;

const position = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);

const heading = 10; // in degree
const pitch = 0; // in degree
const roll = 0; // in degree

const hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(heading), 
Cesium.Math.toRadians(pitch), Cesium.Math.toRadians(roll));

const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(position, hpr);

tileset.modelMatrix = modelMatrix;

Here’s example

That’s really helpful, thank you so much. I’ve tested and its working for me.