mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-18 21:37:55 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
21 lines
802 B
C#
21 lines
802 B
C#
namespace Sandbox;
|
|
|
|
public sealed partial class PlayerController : Component
|
|
{
|
|
/// <summary>
|
|
/// Return an aabb representing the body
|
|
/// </summary>
|
|
public BBox BodyBox( float scale = 1.0f, float heightScale = 1.0f ) => new BBox( new Vector3( -BodyRadius * 0.5f * scale, -BodyRadius * 0.5f * scale, 0 ), new Vector3( BodyRadius * 0.5f * scale, BodyRadius * 0.5f * scale, BodyHeight * heightScale ) );
|
|
|
|
/// <summary>
|
|
/// Trace the aabb body from one position to another and return the result
|
|
/// </summary>
|
|
public SceneTraceResult TraceBody( Vector3 from, Vector3 to, float scale = 1.0f, float heightScale = 1.0f )
|
|
{
|
|
return Scene.Trace.Box( BodyBox( scale, heightScale ), from, to )
|
|
.IgnoreGameObjectHierarchy( GameObject )
|
|
.WithCollisionRules( Tags )
|
|
.Run();
|
|
}
|
|
}
|