Here's a new plugin that implements the terrain hole idea discussed here
This is a more useful version than the experimental implementation I attached to the ModularZonePlugin. (now removed)
As a standalone editor it can be used with anywhere, not just with the ModularZonePlugin.
Terrain Cut Editor Plugin
You can drag a TerrainCutEditor object into to your scene. There is a cube which will represent the bounding box of the editor. It projects a decal mesh onto the terrain below. It can be moved & rotated into position with the standard tools & can be resized using the scale tool. When the scene is exported, it will the Terrain Cut will be exported as follows:
- Code: Select all
<node name="Terrain Cut#0" id="966612736">
<position x="-92.1687" y="185.86" z="-186.055" />
<rotation qw="1" qx="0" qy="0" qz="0" />
<scale x="1.0" y="1.0" z="1.0" />
<terrain_cut name="Terrain Cut#0" x="6" y="6">
<box x="5.63914" y="1.99834" z="5.63914" />
Which provides all the data to recreate the decal in your scene. The bounding box is useful for collision tests. The editor will only produce the cut within the bounding box, ie the box needs to intersect the terrain. By disabling terrain collision on any object within the bounding box, the hole will be traversed as though there was an actual gap in the terrain instead of a tranparent decal.
I've added some code to my PCZ sceneloader to give an idea of how to load the terrain cut from a dotscene file. Basically you create a mesh decal based on the data loaded from the dotscene file, set its material approriately & assign anything that you don't want a hole thru into a different render queue. I haven't implemented the collision test yet because the loader doesn't really have a proper collision system yet.
*In the editor* the tranparency only allows you to see the base of the world and the sky box, because all objects in Ogitor are in RENDER_QUEUE_MAIN. This means the transparency is applied to them as well as the terrain. (It worked with the Modular Zone plugin experiment because I could move zones into whatever render queue I like).I have an idea for a solution but it may be a bit naughty - when the first TerrainCutEditor is added into the world, it could iterate through all objects & shove them into another render queue. For the time being, you'll just see a hole in the terrain with nothing on the other side until you load it into to your game/viewer/other external program.
Cmake script is only set up for Windows. Linux will follow when I get around to it, but I have no access to a Mac, so Apple support will be a long time coming.
The TerrainCutEditor plugin repository is at https://bitbucket.org/Shockeye/terraincutter
The PCZLoader is at https://bitbucket.org/Shockeye/pczloader