I have been trying to get a model into cesium using Model.fromGltf. I can get the model in but don’t understand how to orient it and haven’t been able to find any help. I don’t understand how modelMatrix works. How can I orient an object based off a position and direction in ECEF coordinates? I’ve tried Tranforms.rotationMatrixFromPositionVelocity like this:
const position = Cartesian3.fromDegrees(lon, lat, .altitude);
const velocity = new Cartesian3(velocity_x, velocity_y, velocity_z)
viewer.scene.primitives.add(Model.fromGltf({
url: 'model/scene.gltf',
modelMatrix: Transforms.rotationMatrixFromPositionVelocity(position, velocity),
scale: 5000.0,
}));
I would expect that to place the model at the position and orient it according to the velocity but it stretches the object so it is essentially a line through Earth about 4x as long as earth’s diameter.
Any help would be appreciated. Thanks