Me
The global Me
namespace defines the local player's properties and any scriptable controls, for starters you can get the local player entity using Me.Entity
.
-- Local player entity.
Entity? Me.Entity
-- If we're in spectator mode the spectated entity, else the local player.
Entity? Me.Controller
Camera
The following fields define the local player's point of view.
vec3 Me.Up -- Equals to World.UP rotated by Me.ViewAngles
vec3 Me.Right -- Equals to World.RIGHT rotated by Me.ViewAngles
vec3 Me.Forward -- Equals to World.FORWARD rotated by Me.ViewAngles
float Me.FovX -- Current vertical field of view in radians
float Me.FovY -- Current horizontal field of view in radians
vec3 Me.ViewOrigin -- The coordinates of our point of view
vec3 Me.ViewAngles -- The rotation of our point of view
float Me.MinPitch -- The minimum pitch accepted by the camera.
float Me.MaxPitch -- The maximum pitch accepted by the camera.
vec3 Me.NormalizeRotation(vec3 angles) -- Normalizes the given angles, clamps by the pitch limits, removes roll and returns the result.
bool Me.InputActive -- True if mouse input is currently contributing to the camera rotation.
vec2 Me.Sensitivity -- Sensitivity of the camera in radians per pixel.
vec3 Me.InputRotation -- Difference in rotation that will be applied next frame by user input.
void Me.ScaleInputRotation(vec3 p) -- Applies a coefficient to the input rotation, e.g. vec3(0,0,0) cancels it out.
vec3 Me.ViewPunch -- Current view-punch (Difference between the camera and the target rotation).
bool Me.SetViewPunch(vec3 p) -- Overrides the view-punch, returns false if input is not active.
bool Me.ScaleViewPunch(vec3 p) -- Applies a coefficient to the view-punch, returns false if input is not active.
vec3 Me.TargetRotation -- Target rotation for next frame.
bool Me.SetTargetRotation(vec3 p) -- Overrides the target rotation, returns false if input is not active.
void Me.SetInputMode(bool direct) -- Switches between direct and injected input modes.
Controls
You can also control the local player in-game using the various primitives exposed in the Me
namespace.
-- All functions here return false if the game does not support them / cannot perform it in this frame.
--
bool Me.Say(string text, int chatId) -- Sends the given text in chat.
bool Me.Jump() -- Jumps.
bool Me.Move(int fwd, int right) -- Moves towards a direction, each argument takes -1, 0, or +1.
bool Me.Sprint(bool state) -- Starts or stops sprinting.
bool Me.Crouch(bool state) -- Starts or stops crouching.