public sealed class Sandbox.PlayerController : Sandbox.Component
Related Guides
Broader workflow and conceptual references connected to this API.
Constructors
Showing 1 constructors
public PlayerController()
No results match this filter.
Methods
Showing 13 methods
public BBox BodyBox(float scale = 1, float heightScale = 1)
Return an aabb representing the body
Parameters
scale: Default: 1heightScale: Default: 1
public void CreateBodyRenderer()
public Sandbox.GameObject CreateRagdoll(string name = Ragdoll)
Create a ragdoll gameobject version of our render body.
Parameters
name: Default: Ragdoll
public void Jump(Vector3 velocity)
Adds velocity in a special way. First we subtract any opposite velocity (ie, falling) then we add the velocity, but we clamp it to that direction. This means that if you jump when you're running up a platform, you don't get extra jump power.
public void OnJumped()
public void PlayFootstepSound(Vector3 worldPosition, float volume, int foot)
Play a footstep sound at the given world position. Will only play if the player has a GroundSurface.
public void PreventGrounding(float seconds)
Prevent being grounded for a number of seconds
public void StartPressing(Sandbox.Component obj)
Start pressing a target component. This is called automatically when Use is pressed.
public void StopPressing()
Stop pressing. Pressed will become null.
public Sandbox.SceneTraceResult TraceBody(Vector3 from, Vector3 to, float scale = 1, float heightScale = 1)
Trace the aabb body from one position to another and return the result
Parameters
scale: Default: 1heightScale: Default: 1
public void UpdateAnimation(Sandbox.SkinnedModelRenderer renderer)
Update the animation for this renderer. This will update the body rotation etc too.
public void UpdateDucking(bool wantsDuck)
Called during FixedUpdate when UseInputControls is enabled. Will duck if requested. If not, and we're ducked, will unduck if there is room
public void UpdateLookAt()
Called in Update when Using is enabled
No results match this filter.
Properties
Showing 72 properties
public float Sandbox.PlayerController.AccelerationTime { get; set; }
Amount of seconds it takes to get from your current speed to your requuested speed, if higher
public float Sandbox.PlayerController.AimStrengthBody { get; set; }
How strongly to turn in the eye direction with our body
public float Sandbox.PlayerController.AimStrengthEyes { get; set; }
How strongly to look in the eye direction with our eyes
public float Sandbox.PlayerController.AimStrengthHead { get; set; }
How strongly to turn in the eye direction with our head
public float Sandbox.PlayerController.AirFriction { get; set; }
How much friction to add when we're in the air. This will slow you down unless you have a wish velocity.
public string Sandbox.PlayerController.AltMoveButton { get; set; }
The button that the player will press to use to run
public Sandbox.Rigidbody Sandbox.PlayerController.Body { get; set; }
public Sandbox.CapsuleCollider Sandbox.PlayerController.BodyCollider { get; set; }
public Sandbox.TagSet Sandbox.PlayerController.BodyCollisionTags { get; set; }
public float Sandbox.PlayerController.BodyHeight { get; set; }
public float Sandbox.PlayerController.BodyMass { get; set; }
public float Sandbox.PlayerController.BodyRadius { get; set; }
public float Sandbox.PlayerController.BrakePower { get; set; }
We will apply extra friction when we're on the ground and our desired velocity is lower than our current velocity, so we will slow down.
public Vector3 Sandbox.PlayerController.CameraOffset { get; set; }
public Sandbox.GameObject Sandbox.PlayerController.ColliderObject { get; set; }
public float Sandbox.PlayerController.CurrentHeight { get; set; }
Gets the current character height from `Sandbox.PlayerController.BodyHeight` when standing, otherwise uses `Sandbox.PlayerController.DuckedHeight` when ducking.
public float Sandbox.PlayerController.DeaccelerationTime { get; set; }
Amount of seconds it takes to get from your current speed to your requuested speed, if lower
public float Sandbox.PlayerController.DuckedHeight { get; set; }
public float Sandbox.PlayerController.DuckedSpeed { get; set; }
public bool Sandbox.PlayerController.EnableFootstepSounds { get; set; }
public bool Sandbox.PlayerController.EnablePressing { get; set; }
Allows to player to interact with things by "use"ing them. Usually by pressing the "use" button.
public Angles Sandbox.PlayerController.EyeAngles { get; set; }
The direction we're looking in input space.
public float Sandbox.PlayerController.EyeDistanceFromTop { get; set; }
public Vector3 Sandbox.PlayerController.EyePosition { get; set; }
The player's eye position, in first person mode
public Transform Sandbox.PlayerController.EyeTransform { get; set; }
The player's eye transform, in first person mode
public Sandbox.BoxCollider Sandbox.PlayerController.FeetCollider { get; set; }
public Sandbox.Audio.MixerHandle Sandbox.PlayerController.FootstepMixer { get; set; }
public float Sandbox.PlayerController.FootstepVolume { get; set; }
public Sandbox.Component Sandbox.PlayerController.GroundComponent { get; set; }
The collider component we're standing on. Null if we're standing nothing
public float Sandbox.PlayerController.GroundFriction { get; set; }
The friction property of the ground we're standing on.
public bool Sandbox.PlayerController.GroundIsDynamic { get; set; }
Are we standing on a surface that is physically dynamic
public Sandbox.GameObject Sandbox.PlayerController.GroundObject { get; set; }
The object we're standing on. Null if we're standing on nothing.
public Sandbox.Surface Sandbox.PlayerController.GroundSurface { get; set; }
If we're stnding on a surface this is it
public Vector3 Sandbox.PlayerController.GroundVelocity { get; set; }
The velocity that the ground underneath us is moving
public float Sandbox.PlayerController.Headroom { get; set; }
The distance from the top of the head to the closest ceiling.
public bool Sandbox.PlayerController.HideBodyInFirstPerson { get; set; }
public Sandbox.Component Sandbox.PlayerController.Hovered { get; set; }
The object we're currently looking at
public bool Sandbox.PlayerController.IsAirborne { get; set; }
Not touching the ground, and not swimming or climbing
public bool Sandbox.PlayerController.IsClimbing { get; set; }
Set to true when entering a climbing `Sandbox.Movement.MoveMode`.
public bool Sandbox.PlayerController.IsDucking { get; set; }
True if this player is ducking
public bool Sandbox.PlayerController.IsOnGround { get; set; }
public bool Sandbox.PlayerController.IsSwimming { get; set; }
Set to true when entering a swimming `Sandbox.Movement.MoveMode`.
public float Sandbox.PlayerController.JumpSpeed { get; set; }
public float Sandbox.PlayerController.LookSensitivity { get; set; }
Allows modifying the eye angle sensitivity. Note that player preference sensitivity is already automatically applied, this is just extra.
public Sandbox.Movement.MoveMode Sandbox.PlayerController.Mode { get; set; }
public float Sandbox.PlayerController.PitchClamp { get; set; }
public Sandbox.Component Sandbox.PlayerController.Pressed { get; set; }
The object we're currently using by holding down USE
public float Sandbox.PlayerController.ReachLength { get; set; }
How far from the eye can the player reach to use things
public Sandbox.SkinnedModelRenderer Sandbox.PlayerController.Renderer { get; set; }
The body will usually be a child object with SkinnedModelRenderer
public bool Sandbox.PlayerController.RotateWithGround { get; set; }
public float Sandbox.PlayerController.RotationAngleLimit { get; set; }
public float Sandbox.PlayerController.RotationSpeed { get; set; }
public bool Sandbox.PlayerController.RunByDefault { get; set; }
If true then the player will run by default, and holding AltMoveButton will switch to walk
public float Sandbox.PlayerController.RunSpeed { get; set; }
public bool Sandbox.PlayerController.ShowColliderComponents { get; set; }
public bool Sandbox.PlayerController.ShowCreateBodyRenderer { get; set; }
If true we'll show the "create body" button
public bool Sandbox.PlayerController.ShowRigidbodyComponent { get; set; }
public bool Sandbox.PlayerController.StepDebug { get; set; }
Enable debug overlays for this character
public bool Sandbox.PlayerController.ThirdPerson { get; set; }
public Sandbox.TimeSince Sandbox.PlayerController.TimeSinceGrounded { get; set; }
Amount of time since this character was last on the ground
public Sandbox.TimeSince Sandbox.PlayerController.TimeSinceUngrounded { get; set; }
Amount of time since this character was last not on the ground
public string Sandbox.PlayerController.ToggleCameraModeButton { get; set; }
public System.Collections.Generic.List`1<Sandbox.Component.IPressable.Tooltip> Sandbox.PlayerController.Tooltips { get; set; }
The tooltip of the currently hovered Pressable object
public bool Sandbox.PlayerController.UseAnimatorControls { get; set; }
public string Sandbox.PlayerController.UseButton { get; set; }
The button that the player will press to use things
public bool Sandbox.PlayerController.UseCameraControls { get; set; }
public bool Sandbox.PlayerController.UseFovFromPreferences { get; set; }
public bool Sandbox.PlayerController.UseInputControls { get; set; }
public bool Sandbox.PlayerController.UseLookControls { get; set; }
When true we'll move the camera around using the mouse
public Vector3 Sandbox.PlayerController.Velocity { get; set; }
Our actual physical velocity minus our ground velocity
public float Sandbox.PlayerController.WalkSpeed { get; set; }
public Vector3 Sandbox.PlayerController.WishVelocity { get; set; }
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.PlayerController |