atl/sm/localplayer
import "atl/sm/localplayer"The player on this client (sm.localPlayer).
Functions
Section titled "Functions"func Player() sm.PlayerThe local Player object.
func ID() intThe local player's id.
func World() sm.WorldThe world the local player is in.
func Position() sm.Vec3The local character's position, or zero when there is no character.
func Direction() sm.Vec3func Right() sm.Vec3func Up() sm.Vec3The look direction and the directions to its right and up.
func SetDirection(d sm.Vec3)Turns the view to face direction d.
func Raycast(rng float64, origin, direction *sm.Vec3) (physics.RaycastHit, bool)Raycasts from the player's view up to rng meters; origin and direction default to the view.
func LatestRaycast() (physics.RaycastHit, bool)The raycast the game made for the player's interaction this frame.
func RaycastStart() sm.Vec3Where interaction raycasts start.
func ActiveItem() sm.UuidThe uuid of the item in the selected hotbar slot.
func SelectedHotbarSlot() intThe selected hotbar slot index.
func Inventory() sm.Containerfunc Hotbar() sm.Containerfunc Carry() sm.ContainerThe player's inventory, hotbar and carried-item containers.
func AimSensitivity() float64The player's aim sensitivity setting.
func IsInFirstPersonView() boolTrue in first person view.
func WantsSprint() boolTrue while the sprint input is held.
func SetLockedControls(locked bool)Freezes movement and look input, e.g. while one of your menus is open.
func SetBlockSprinting(block bool)Prevents sprinting.
func AddRenderable(rend string)func RemoveRenderable(rend string)Adds / removes a renderable drawn on the first person view model.
func UpdateFpAnimation(name string, time float64, weight *float64, looping bool)Plays a first person animation at time with an optional blend weight.
func FpBonePosition(bone string) sm.Vec3World position of a bone of the first person model.
func FpAnimationInfo(name string) sm.AnimationInfoInformation about a first person animation.
func CarryColor() sm.ColorThe color of the carried item.
func OwnedLift() sm.LiftThe lift the local player owns.
func SecondaryInteractBusy() boolTrue while the equipped tool uses the secondary interaction (e.g. aiming).
func GarmentName(u sm.Uuid) stringfunc GarmentUpperCaseTitle(u sm.Uuid) stringA garment's (cosmetic's) name and its upper-case title.
func IsGarmentUnlocked(u sm.Uuid) boolTrue if the player has unlocked a garment.
func GrantQuestItem(u sm.Uuid)Survival only: unlocks a cosmetic.
MouseDelta
Section titled "MouseDelta"type MouseDelta struct { X, Y float64}Mouse movement this frame.
func ReadMouseDelta() MouseDeltaReads this frame's mouse movement.
Placement
Section titled "Placement"type Placement struct { Position sm.Vec3 Rotation sm.Quat}A position and rotation.
func ConstructionPlacement() (Placement, bool)Where the shape being placed would go, or false when the player isn't placing.