How to set Frustum Geometry orientation to be the same as the Camera Orientation

Hi all,

I am currently having a hard time setting the Frustum Geometry orientation to be the same as the Camera Orientation. Here’s a snippet of my code:

const orientation = {
heading: Cesium.Math.Radians(headingDegree),
pitch: Cesium.Math.Radians(pitchDegree),
roll: Cesium.Math.Radians(rollDegree),
}

// Camera
viewer.camera.flyTo({
destination: origin,
orientation,
})

const hpr = Cesium.HeadingPitchRoll.fromDegrees(headingDegree, pitchDegree, rollDegree)
const quaternion = Cesium.Quaternion.fromHeadingPitchRoll(hpr)

// FrustumGeometry
const frustumGeometry = new FrustumOutlineGeometry({
frustum,
origin,
orientation: quaternion
})

``

Here’s a screenshot of the result:

Screenshot from 2019-08-21 14-09-49.png

Origin is correct but the Frustum is facing a different direction. How do I set its orientation to be the same as that of the camera given the heading, pitch, roll? I hope someone can help me.

Thank you!

Bump

You can extract the frustum directly from the camera here:

https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=camera#frustum

Is this what you’re passing to the geometry constructor? You might also want to look into the 3D Tiles inspector, which already has a way to visualize the camera frustum:

https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=3D%20Tiles%20Inspector.html&label=All

If you click “Update” and “Freeze frame” and then zoom out you’ll see it. You can see the code that sets this up here:

Hi Omar,

Sorry for the late reply. Thank you for this one. Though is there a way to edit the debugFrustumPlane color?

Thanks!

You might need to modify the default color in the source since it’s a private class: