Make VelocityOrientationProperty better handle case where entity stops
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
`VelocityOrientationProperty` is very useful when you have a vehicle or aircraft that's moving, and you don't have any data on its orientation, and want to visualize the direction it's moving in. It's used in the Time Dynamic Wheels example:
https://sandcastle.cesium.com/index.html?src=Time%20Dynamic%20Wheels.html
The issue is that if the vehicle stops, the orientation becomes undefined, causing an abrupt change in the vehicle's orientation. You can see it in [this modified Sandcastle example](https://sandcastle.cesium.com/index.html#c=zVfbcts2EP2VHb+UsmWKoqyLZTtT12nadJxYjV23D5rJQCQkYUwCHAC0onT8712ABElJdJLHPlgmwcVezu4eLJ6JhGdGN1TCFXC6gRuqWJ76j3bNmx9F9v1GcE0Yp3J+1IV/5xxArUWexNecpUTTKWiZ0+6cv3Qu5nzOe70P5ImCyiV12pkCokGvKcSoUdIYNEupP+fP6IHSRGp0oDT+R54wwt+iYn8pRWoePOObfQiD/qQL/T7+hfg37BiTRokWmiT3NBI8VqirH1w45SJr1U3iuBT3bETGia55amqyCw1g6v1eZ86tbRugHyUievKtkgeMDC3aZ7POUfZQUGSVnMheE4tyKSn/IY329xPhK1pHe1Ot+bd3d7PP9w93s3qfyUCCWfW/CpE+CK9AwPrj8gg3kmKsQCAjeg1LIUHkWDJ0zaKEwmILCZUZ4ytYUL2hlIPeCMiEYpoJrsr8uvfdGrsnaZbQeFZ+nEmRUam3XueiURWz1q03+AWfCB/Y1J2Gg/H5cDjyx+fng3E4GZ3ZtJ2ejUbDYTjxw2AYDIJwNLDLg1E4CfoDvx+Mhufno/GkzCOapDz+cYOjYOCPg/FZPxiMz8a1xVE48M8m5+dBOKkMjiejwJ+E4+BsOBoX9hDcawQSM8T0Fh8ijeBmJQiwYUkCK/ZMIVe2bbAKUO4nBSqj2D2ExxBjH0XWV2wtwrdWnjcby6l/tNodwnut3ipjw3R5s1EsSaJoDdWu6lfRKiO9Rxlq49isKU0wD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XyKGR7GyNNvmcoSssUrZ8wOsvj2FaGyaQFPmaDrnvsBvhUvzj+6pXfLJeZ0+sr5HXSRr4ZdCDoVSK6HykuTRPdpXNdns17NvNl8982md8gur87Hp33jMYzNz5kfGFNH3aNLpbcJfeMC+ZmlmcAbci4TD2tHU6wdMxv1Fjn6gjdCpdywd9lrbr2M2TOw+KrlHg9RQpTCL8s8Se7ZVzo/enPZQ/mDrYnAA5iv7nBOR8iN2Lr/5rZY9H3/soev7Tu1EFg9ck/zfw) where the vehicle stops halfway through.
There's no "correct" orientation here. Intuitively you want to have it use the last orientation (which could be different depending on if you're scrubbing the timeline forwards or backwards). With that said, I think having CesiumJS just keep the last defined orientation and use that in cases when the entity isn't moving would look and feel a lot better.
Otherwise the workaround needed for this is to define a composite property that defines the orientation as `VelocityOrientationProperty` when the vehicle is moving, and otherwise use a constant orientation that you manually specify for the periods where the vehicle isn't moving.
Originally came up on the forum:
* https://community.cesium.com/t/the-orientation-of-vehicles-has-problem-when-waiting-in-front-of-traffic-light/8264/2
* https://community.cesium.com/t/should-cesium-extrapolationtype-hold-consider-last-known-orientation/9593/2
Contributor guide
Research direction
Start with the VelocityOrientationProperty implementation and reproduce the behavior in the modified Time Dynamic Wheels Sandcastle example linked in the issue. Trace how orientation is computed when the vehicle stops, then verify that the last defined orientation is retained during stopped intervals, including timeline scrubbing forwards or backwards.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100