-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes issue #12465 (Entity Tracking broken) #12467
base: main
Are you sure you want to change the base?
Changes from all commits
4e3b1f7
d8e6868
610a5ae
86e3417
b52997c
6b0e50c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,43 +89,74 @@ describe( | |
expect(view.scene.camera.position).toEqualEpsilon(sampleOffset, 1e-10); | ||
}); | ||
|
||
it("uses entity bounding sphere", function () { | ||
const sampleOffset = new Cartesian3( | ||
-1.3322676295501878e-15, | ||
-7.348469228349534, | ||
7.3484692283495345, | ||
); | ||
it("uses provided bounding sphere", function () { | ||
const bs = new BoundingSphere(new Cartesian3(3, 4, 5), 6); | ||
scene.camera.viewBoundingSphere(bs); | ||
const positionWC = scene.camera.positionWC.clone(); | ||
|
||
const entity = new Entity(); | ||
entity.position = new ConstantPositionProperty( | ||
Cartesian3.fromDegrees(0.0, 0.0), | ||
); | ||
const view = new EntityView(entity, scene, undefined); | ||
view.update( | ||
JulianDate.now(), | ||
new BoundingSphere(new Cartesian3(3, 4, 5), 6), | ||
); | ||
expect(view.scene.camera.position).toEqualEpsilon(sampleOffset, 1e-10); | ||
view.update(JulianDate.now(), bs); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC, 1e-10); | ||
|
||
entity.trackingReferenceFrame = TrackingReferenceFrame.INERTIAL; | ||
view.update( | ||
JulianDate.now(), | ||
new BoundingSphere(new Cartesian3(3, 4, 5), 6), | ||
); | ||
expect(view.scene.camera.position).toEqualEpsilon(sampleOffset, 1e-10); | ||
view.update(JulianDate.now(), bs); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC, 1e-10); | ||
|
||
entity.trackingReferenceFrame = TrackingReferenceFrame.VELOCITY; | ||
view.update( | ||
JulianDate.now(), | ||
new BoundingSphere(new Cartesian3(3, 4, 5), 6), | ||
); | ||
expect(view.scene.camera.position).toEqualEpsilon(sampleOffset, 1e-10); | ||
view.update(JulianDate.now(), bs); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC, 1e-10); | ||
|
||
entity.trackingReferenceFrame = TrackingReferenceFrame.ENU; | ||
view.update( | ||
JulianDate.now(), | ||
new BoundingSphere(new Cartesian3(3, 4, 5), 6), | ||
view.update(JulianDate.now(), bs); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC, 1e-10); | ||
}); | ||
|
||
it("jumps to updated bounding sphere", function () { | ||
const bs1 = new BoundingSphere(new Cartesian3(1, 2, 3), 4); | ||
scene.camera.viewBoundingSphere(bs1); | ||
const positionWC1 = scene.camera.positionWC.clone(); | ||
|
||
const bs2 = new BoundingSphere(new Cartesian3(3, 4, 5), 4); | ||
scene.camera.viewBoundingSphere(bs2); | ||
const positionWC2 = scene.camera.positionWC.clone(); | ||
|
||
const entity = new Entity(); | ||
entity.position = new ConstantPositionProperty( | ||
Cartesian3.fromDegrees(0.0, 0.0), | ||
); | ||
expect(view.scene.camera.position).toEqualEpsilon(sampleOffset, 1e-10); | ||
const view = new EntityView(entity, scene, undefined); | ||
view.update(JulianDate.now(), bs1); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC1, 1e-10); | ||
|
||
view.boundingSphere.center = bs2.center; | ||
view.update(JulianDate.now()); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC2, 1e-10); | ||
}); | ||
|
||
it("jumps to new bounding sphere", function () { | ||
const bs1 = new BoundingSphere(new Cartesian3(1, 2, 3), 4); | ||
scene.camera.viewBoundingSphere(bs1); | ||
const positionWC1 = scene.camera.positionWC.clone(); | ||
|
||
const bs2 = new BoundingSphere(new Cartesian3(3, 4, 5), 4); | ||
scene.camera.viewBoundingSphere(bs2); | ||
const positionWC2 = scene.camera.positionWC.clone(); | ||
|
||
const entity = new Entity(); | ||
entity.position = new ConstantPositionProperty( | ||
Cartesian3.fromDegrees(0.0, 0.0), | ||
); | ||
const view = new EntityView(entity, scene, undefined); | ||
view.update(JulianDate.now(), bs1); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC1, 1e-10); | ||
|
||
view.boundingSphere = bs2; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is valuable to make sure changing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch @jjspace. Added new test. Should be ready for a final (hopefully 😅) review! |
||
view.update(JulianDate.now()); | ||
expect(scene.camera.positionWC).toEqualEpsilon(positionWC2, 1e-10); | ||
}); | ||
|
||
it("uses entity viewFrom if available and boundingsphere is supplied", function () { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that modifies the bounding sphere to prove that the camera will follow it on future calls to
update
?(I didn't check all the other specs so if it already exists just lmk)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jjspace, done! This should be ready for another review