Skip to content

Commit

Permalink
fix the restore issue #50
Browse files Browse the repository at this point in the history
  • Loading branch information
cavencj committed Jul 22, 2021
1 parent 6277f0f commit 8a52acc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions modules/history-track/Track.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,17 @@ class Track {
} else {
this._delegate.position = p
}
let o = this._velocityOrientation.getValue(now)
if (o) {
this._delegate.orientation = o
let orientation = this._velocityOrientation.getValue(now)
if (orientation) {
this._delegate.orientation = orientation
}
let time = this._timeLine[this._positionIndex]
if (time) {
let timeDiff = Cesium.JulianDate.secondsDifference(now, time)
if (timeDiff >= 0 && timeDiff <= 1) {
let position = this._positions[this._positionIndex] || undefined
if (position) {
let mat = Cesium.Matrix3.fromQuaternion(
this._delegate.orientation.getValue(now)
)
if (position && orientation) {
let mat = Cesium.Matrix3.fromQuaternion(orientation)
let mat4 = Cesium.Matrix4.fromRotationTranslation(mat, p)
let hpr = Cesium.Transforms.fixedFrameToHeadingPitchRoll(mat4)
position.heading = Cesium.Math.toDegrees(hpr.heading)
Expand Down

0 comments on commit 8a52acc

Please sign in to comment.