I am trying to display frustums based on different origin and HPR. When I tried using the Frustum Geometry, its orientation doesn’t seem right. Here’s a code snippet:
const origin = Cesium.Cartesian3.fromDegrees(lon, lat, height);
const rotation = new Cesium.HeadingPitchRoll(heading, pitch, roll);
const orientation = Cesium.Quaternion.fromHeadingPitchRoll(rotation);
let frustum = new Cesium.PerspectiveFrustum();
frustum.fov = Cesium.Math.toRadians(fov);
frustum.aspectRatio = aspectWidth / aspectHeight;
frustum.near = 1.0;
frustum.far = 30.0;
const frustumGeometry = new Cesium.FrustumOutlineGeometry({
frustum,
origin,
orientation,
});
const frustumOutlineGeometryInstance = new Cesium.GeometryInstance({
geometry: frustumGeometry,
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 1.0, 1.0, 1.0))
},
});
But when I checked using the Camera, its debug frustum is correct.
const orientation = {
heading,
pitch,
roll,
}
viewer.camera.flyTo({
destination: origin,
orientation,
})
Here’s a screenshot. Black one is the Frustum Geometry. Blue one is from the debug frustum planes.
Why is it different even if I am using the same HPR values? I need the Frustum to be the same orientation as the debug frustum plane.
Thank you for the help!