mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-07-31 15:58:27 -04:00
* Move all unit tests to Engine/Tests * Fix Margin.EdgeSubtract * Fix Capsule.Contains * EnvironmentVariables.Remove if it's null * Fixed ray trace never returning startedsolid * Fix HistoryList.Navigate on empty list * Fix GameObject.WorldPosition accepting NaNs * Fix flex: initial expanding to the wrong grow/shrink * Translation.TryConvert shouldn't throw on invalid enum strings * Skip sound file tests on machines with no audio device
36 lines
729 B
C#
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;
|
|
}
|
|
}
|
|
}
|