Files
sbox-public/engine/Sandbox.Compiling.Test/Data/code/extension/MyToolIsCool.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

36 lines
729 B
C#

using Sandbox;
using System.Collections.Generic;
using System.Linq;
public class MyToolIsCool : Sandbox.Tools.BaseTool
{
List<Vector3> points;
public override void Simulate()
{
base.Simulate();
points ??= new List<Vector3>();
var point = Owner.EyePosition + Owner.EyeRotation.Forward * 200;
var tr = Trace.Ray( Owner.EyePosition, Owner.EyePosition + Owner.EyeRotation.Forward * 5000 )
.UseHitboxes()
.Ignore( Owner, true )
.WithAllTags( "solid" )
.Run();
points.Add( tr.EndPosition + tr.Normal * 1.0f );
while ( points.Count > 1000 )
points.RemoveAt( 0 );
var prev = points.First();
foreach ( var p in points.Skip( 1 ) )
{
DebugOverlay.Line( prev, p, 0.01f );
prev = p;
}
}
}