set location||doc135452

September 20, 2022

Format

 Entity:setPos(pos, yaw, pitch)
  • The class to which the function belongs:Entity

Description

Sets the entity's position to the specified coordinates.


Parameters

Variable name type Description
pos Vector3 coordinate
yaw float yaw orientation angle
pitch float pitch axis angle


Code Samples

on the server sideglobal script, registering at the start of the gameCallback, set all player position coordinates to (0, 0, 0)

Trigger.RegisterHandler(World.cfg, "GAME_START", function()
    local players = Game.GetAllPlayers()
    for i, v in pairs(players) do
        v:setPos(Lib.v3(0, 0, 0), 0, 0)
    end
end)