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

116 views
Skip to first unread message

agustin.j...@gmail.com

unread,
Aug 21, 2019, 2:16:18 AM8/21/19
to cesium-dev
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! 

agustin.j...@gmail.com

unread,
Aug 21, 2019, 9:16:07 PM8/21/19
to cesium-dev
Bump

Omar Shehata

unread,
Aug 23, 2019, 4:22:35 PM8/23/19
to cesium-dev
You can extract the frustum directly from the camera here:


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:


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:

agustin.j...@gmail.com

unread,
Sep 2, 2019, 11:53:13 PM9/2/19
to cesium-dev
Hi Omar,

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

Thanks!

Omar Shehata

unread,
Oct 3, 2019, 2:07:57 PM10/3/19
to cesium-dev
Reply all
Reply to author
Forward
0 new messages