Hi guys, iam trying to put a new model (glft) with the same position and rotation of camera, but when i use the listener for cameras, i receive the position Cartesian3 (and not found any rotation parameter)
But the model need to pass position Cartesian3.fromDegress and orientation HeadingPitchRoll.
How i convert the camera position&rotation to model position&orientation?
// Create Entity Model
const scale: 6;
const height: 1;
const lat = -43.1918484;
const long = -22.8943629;
const position = Cartesian3.fromDegrees(
lat,
long,
height,
);
const heading = CesiumMath.toRadians(0);
const pitch = 0;
const roll = 0;
const rotation = new HeadingPitchRoll(heading, pitch, roll);
const orientation = Transforms.headingPitchRollQuaternion(
position,
rotation,
);
const uri: string = AvatarsConstants.DEFAULT_AVATAR_URL;
const avatarModel: Entity = viewer.entities.add({
name: 'name',
position,
orientation,
model: {
scale,
uri
},
});
// Get the position of camera
viewer.camera.changed.addEventListener(() => {
const { position } = viewer.camera;
})