Skip to content

Commit

Permalink
Added support for terrains in MergeSplitProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipAlg committed Nov 7, 2024
1 parent 14c8d93 commit 8c76324
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion AGXUnity/MergeSplitProperties.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using AGXUnity.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
Expand Down Expand Up @@ -145,6 +146,16 @@ protected override bool Initialize()
}
}

var terrains = GetComponentsInChildren<DeformableTerrainBase>();
foreach ( var terrain in terrains ) {
if ( terrain is DeformableTerrain regular )
Add( agxSDK.MergeSplitHandler.getOrCreateProperties( regular.GetInitialized().Native.getGeometry() ) );
else if ( terrain is MovableTerrain movable )
Add( agxSDK.MergeSplitHandler.getOrCreateProperties( movable.GetInitialized().Native.getGeometry() ) );
else if ( terrain is DeformableTerrainPager pager )
Debug.LogWarning( $"MergeSplitProperties '{name}' cannot be applied to child '{terrain.name}' as Pagers are not currently supported" );
}

GeometryContactThresholds.GetInitialized<GeometryContactMergeSplitThresholds>();
ConstraintThresholds.GetInitialized<ConstraintMergeSplitThresholds>();

Expand Down

0 comments on commit 8c76324

Please sign in to comment.