Closed j9liu closed 7 months ago
In Unity 2022.3 (20f1, but it probably doesn't matter), with the Splines package not installed to start:
I tried clicking on a different game object and then back on the CesiumCartographicPolygon game object, but it didn't help. I also tried disabling and re-enabling the Cesium Cartographic Polygon component by clicking the checkbox next to it, but that didn't help either.
Eventually I disabled the entire CesiumCartographicPolygon game object by clicking the checkbox at the top of the inspector.
All the extra stuff immediately appeared, even without enabling it:
Not sure if this is solvable, so it might just be a documentation matter.
Also, the created Spline Container in the above scenario had default settings, which made it hard to use.
This looks really good! One thing I want to test is that the packaged version of the plugin works just as well, in both 2021.3 and 2022.2. But to do that, we need a working build from CI, which is proving elusive. At the moment, the problem is that Chocolatey is down, so none of our self-hosted builds can start. 😞
Thanks for the review @kring ! I just pushed some code that should improve the case where a polygon is created before the Splines package is added.
I just pushed some code that should improve the case where a polygon is created before the Splines package is added.
I tried this out and it looks good!
I also tested the release package in 2021.3 and 2022.3, and it also works well in both cases.
It's pretty amazing how well this turned out, and how quickly. Nice job!
Fixes #360 #64. Depends on #405 (which itself depends on material keys), so merge that first.
This PR adds support for rasterized polygon clipping.
DISCLAIMER: This requires the Splines package, which is only available in Unity 2022.2 or later. It's not listed as a package dependency, so our package will still load in 2021.3. However, this functionality will be inaccessible in the older versions.
Workflow
The workflow is similar to Cesium for Unreal's. Users can add a
CesiumCartographicPolygon
from the quick add panel.This will spawn a game object with a
CesiumCartographicPolygon
component, which automatically adds aSpline
andCesiumGlobeAnchor
component. You can modify the game object's transform, add or remove points from the spline component, and edit the spline itself by clicking this icon in the Scene View.Note that the spline is required to be closed, and completely linear. If either of these conditions is not true, the polygon will log errors. Interestingly, the Spline component supports multiple splines. For simplicity, only the first one is rasterized.
Then, you can connect this polygon to a tileset using the
CesiumPolygonRasterOverlay
component. The settings are exactly the same as in Unreal.The materials have been modified to handle alpha clipping via "Clipping" overlay parameters. The final result:
Splines package missing (Unity 2022.2+)
The assembly definition has been modified to reference the
com.unity.splines
package. If it isn't detected, then theSUPPORTS_SPLINES
won't be defined. Users will still be able to addCesiumCartographicPolygon
andCesiumPolygonRasterOverlay
through the UI, but they will appear with these warnings:Splines package unavailable (Unity 2021.3f)
com.unity.splines
is not listedpackage.json
as a dependency, so Cesium for Unity isn't blocked from loading in earlier versions. When it does load, there will be no UI to addCesiumCartographicPolygon
, andCesiumPolygonRasterOverlay
is hidden from the component menu. If somehow they make their way into the scene, these warnings will appear: