Entity preserves z value while keeping xy during dragged by mouse

Hi,

Is there a way to keep height of the entities while it is dragged and follows the mouseXY?

I’m wondering if it is about with Camera angle but I have no idea.

You might find helpful to show the solution with the bad example below

Any advice is appreciated, thanks.

Hi, I am also facing a similar issue.
I am trying to implement drag on x - y axis.
I have a box entity and I placed point entities on its circumference. By dragging each point I would like to resize and rotate the box.

Capture

To achieve the desired behavior I need the point to only move on the plane of the top face of the box.
has anyone achieved a similar behavior?

would appreciate yo hear if you advanced or solved the issue…

thanks

1 Like

@roi081295
you can use this function to create a mathematical plane to make the point only movable upon a specific plane.

https://cesium.com/learn/ion-sdk/ref-doc/Plane.html?classFilter=plane

Hi @Hiroshi_Yaginuma,

Thank you for your response!
I actually tried using the Plane.FromPointNormal and then use IntersectionTests.rayPlane with the pick ray to get the end point of drag. Do you think this is the right approach?

const normal = ellipsoid.geodeticSurfaceNormal(startGeoPosition);
const plane = Cesium.Plane.fromPointNormal(startGeoPosition, normal);
const ray = viewer.camera.getPickRay(movement.endPosition);
const endGeoPosition = IntersectionTests.rayPlane(ray, plane);

The endGeoPosition is then used to update the dragged point location via a callback property.

Although this does not give the desired result.
In addition, the plane should not curve with the ellipsoid of the earth.

Thank you

that is correct approach.
you just need to consider reference frame of the coordinates of the plane. Make sure you transform by correct inverse matrix.

Thank you for the reply!
I put togther a sandcastle link showing my use case and problem.
Points are dragabble using Alt.

Could you show mw what you mean?

Thanks again