mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-05-19 04:17:04 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
31 lines
690 B
C#
31 lines
690 B
C#
namespace Editor.TerrainEditor;
|
|
|
|
/// <summary>
|
|
/// Flatten an area of terrain.
|
|
/// </summary>
|
|
[Title( "Flatten" )]
|
|
[Icon( "trending_flat" )]
|
|
[Alias( "flatten" )]
|
|
[Group( "1" )]
|
|
[Order( 0 )]
|
|
public class FlattenTool : BaseBrushTool
|
|
{
|
|
public FlattenTool( TerrainEditorTool terrainEditorTool ) : base( terrainEditorTool )
|
|
{
|
|
Mode = SculptMode.Flatten;
|
|
}
|
|
|
|
public override bool GetHitPosition( Terrain terrain, out Vector3 position )
|
|
{
|
|
if ( _dragging )
|
|
{
|
|
var tx = terrain.WorldTransform;
|
|
var hit = StrokePlane.Trace( Gizmo.CurrentRay, true );
|
|
position = tx.PointToLocal( hit.Value );
|
|
return hit.HasValue;
|
|
}
|
|
|
|
return base.GetHitPosition( terrain, out position );
|
|
}
|
|
}
|