How to get one end of a polyline clamped

I have a use-case when I have a location for an Entity which is close to the ground which I am clamping to the ground (thus slightly moving it’s position). I am then trying to draw a line from a location in the air to that exact clamped location. If I pass in the same location I did for the Entity before it’s clamped, it correctly draws to the unclamped Entity position but I want it to draw to the clamped position. Is there any way to clamp just the one endpoint of a polyline? I’ve tried using a few other calculations on the forum including sampleTerrain, sampleTerrainMostDetailed, and globe.getHeight to get the position of the clamped entity but everything I try is still off. Any ideas on how to accomplish this?

Hey John, nice to see you on the forum!

I had the exact same use case a few years ago, this GitHub issue describes a few ways to achieve that: Let me know if that works for you.