1

i am using cesium with drawHelper plugin on GWT (Cesium Terrain Server for terrain). i am drawing shapes(marker , polyline , polygon..) to my 3d map. I can draw shapes to the map with exact coordinates where my mouse is pointing but when i change the angle of camera look , i cannot draw shapes where my mouse pointing because i am getting wrong coordinates and this leads to draw my shapes on wrong coordinates. (i get coordinates from DrawHelpers shape create event for instance 'markerCreated' returns position)

hkn
  • 371
  • 1
  • 14
  • I think this is similar to [navigating on cesium terrain map, corrupts position of graphics](http://stackoverflow.com/questions/33370129/navigating-on-cesium-terrain-map-corrupts-position-of-graphics/33372453#33372453). – emackey Nov 04 '15 at 14:48
  • Actually its not because it was about draping and pinning shapes on terrain , this is about getting wrong mouse position . – hkn Nov 05 '15 at 05:58
  • Sure, but it's the same root cause, though: Picking the ellipsoid instead of picking the terrain. That's why switching to the other pick function, in your solution below, works. – emackey Nov 05 '15 at 15:58

1 Answers1

3

I solved my problem with editing DrawHelper.js , it was getting position with scene.camera.pickEllipsoid function , i changed it with creating a ray and picking position via globe.pick. Code :

var cartesian = scene.camera.pickEllipsoid(movement.position,ellipsoid)

Replaced it with

var ray = scene.camera.getPickRay(movement.position);
var pickedPosition = scene.globe.pick(ray,scene);
if(pickedPosition){
markers.addBillBoard(pickedPosition);
_self.stopDrawing();
options.callback(pickedPosition);

Adding marker on terrain to the coordinates which pointing from mouse fixed like this...

hkn
  • 371
  • 1
  • 14