1. A concise explanation of the problem you’re experiencing.
Load 3dTileset
-
Add a fixed marker (billboard) - M1.
-
Add a polyline entity with a CallbackProperty( () => [lastMarker, lastGoodCartesianMouseCoordinate], false) for the entity.polyline.positions where one end is at M1 and the other end tracks under the mouse but from the depth picker.
-
Add a marker(billboard) - M2- with a CallbackProperty( () => lastGoodCartesianMouseCoordinate, false) for the entity.position, i.e. it tracks under the mouse.
Bug observed. lastMarker is M1 position
(Optional)
- Add a marker (billboard) - M3 - fixed. lastMarker becomes M3 position.
polyline has correctly dynamically updated to M3 -> mouse
Bug Observed: M2 stays under mouse only while the mouse events are rapidly firing and somehow pings back to M1 position.
Bug: Our model is very big and as you zoom and rotate around is rerendering LODs. if you are in the guts of it it might take up to 20 seconds to stop loading, but depending on what they are doing they might only rarely wait for a full render to finish before moving on again in the model.
During the render phase as you are dragging the mouse around M2 is under the mouse but as soon as the mouse stops moving it pings back to the M1 position.
I have tried global variables, instance variables, redux store and they all behave the same - seems to be intrinsically related to the callback evaluation while a render is in progress.
Nothing seems to be globally wrong with the value of lastGoodCartesianMouse coordinate because there is nothing wrong with the endpoint of the polyline, it tracks under the mouse perfectly. The setter doesn’t weirdly log M1 position it is the correct position under the mouse. Logging in the move event setter shows its not being set to the M1 position anywhere near logging callback.getValue shows the callback is returning M1.position value (Cartesian3.equals() = true). not clear how the callback is evaluating to that unless the entities are getting mixed up when evaluating the position (possibly?).
Also steps 1 and 2 alone renders fine at all times, and steps 1 and 3 renders fine at all times (i.e. only add one but not both of the entities)
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
This works fine in the sandbox environment, and weird behaviour is limited to the callback firing while a full render update is in progress. In our app increasing the MSSE dramatically decreases the length of time the render takes and takes us from a 20 second render with weird behaviour to 2-5 seconds of weird behaviour - so it is limited to the LoD reload phase.
I don’t know if there is a straightforward way using common public assets to deliberately recreate this heavy render environment to reproduce this window of time in the sandbox? I’m happy to try to get a proper reproduction if there is any guidance on the best way to overwork render in the sandbox.
I adapted this onto the clipping planes example disabling the planes stuff to explore in the sandbox.
var position = null;
function getPositions() {
return [tileset.boundingSphere.center, position]
}
function getPosition() {
return position
}
var moveHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
moveHandler.setInputAction(function(movement) {
if (position) {
var p = viewer.scene.pickPosition(movement.endPosition)
if§ {
position = p
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
…
tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
var radius = boundingSphere.radius;
position = boundingSphere.center;
viewer.entities.add({polyline:{positions:new Cesium.CallbackProperty(getPositions,false)}})
viewer.entities.add({position:new Cesium.CallbackProperty(getPosition,false), billboard:{eyeOffset:new Cesium.Cartesian3(0,0,-10),width:10,height:10, image:"…"}})
[…]
}
– can’t reproduce bug in sandbox, but also can’t actively cause this to happen during a massive render/LoD rebuild.
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
Show an asset at the end of the polyline as the mouse is moved around.
4. The Cesium version you’re using, your operating system and browser.
Cesium 1.46, OSX, Chrome 67