public sealed class TerrainPhysicsModuleGives the editor's play sessions terrain collision, and the sculpt tools a seam to push into.
Remarks
The reach half of docs/plan/31 § D10. TerrainColliders and TerrainColliderSystem were both written and both tested, and nothing in the product constructed either: TerrainEdit.Colliders was assigned in five test files and nowhere else, so every assertion about a stroke naming the right tiles was one double talking to another. This is the module that closes it — registered in EditorModules.Standard beside Terrain, through the same door a third-party plugin comes through.
⚠ Two contributions with two different lifetimes, and confusing them is the trap. The ITerrainColliders published into PluginServices lives as long as the editor, because TerrainModule.BindColliders binds the first one it finds and never re-reads — so a per-session adapter would leave the sculpt tools holding a disposed Jolt world for every stroke after the first Stop. The TerrainColliderSystem behind it lives for one play session, because that is when there is a PhysicsScene to build bodies in. The published object is a switch between the two.
⚠ It builds no simulation of its own and refuses to. The PhysicsScene comes from PlaySession.TryGet — the editor application provides one — and a session that has none runs no collider system at all, which is ITerrainColliders' own "a terrain with no collision, not an error". A module that stood up a second physics world would be a scene in which the ground and everything else collided with nothing, silently.
⚠ And it does not catch what Rebuild throws. An out-of-range tile index is a caller's bug that used to corrupt a *different* tile in silence — see that method's own remarks — and a module that swallowed the exception here would put the silence back with an extra step in front of it.
Fields and properties (2)
public const string ModuleIdWhat the host activates it under, and what a plugin depending on it names.
public const string ModuleNameWhat a plugin-management panel calls it.
Methods (2)
public void Activate(PluginContext context)Adds everything the plugin contributes.
public void Deactivate()Releases what the registration scope does not know about.
Used by (1)
- EditorModulesVixen.Editor.Host