Set up map and coordinates||doc135503

September 20, 2022

Format

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

Description

Set the map and coordinates.


Parameters

Variable name type Description
map Map Map
pos Vector3 coordinate
yaw float yaw orientation angle
pitch float angle of the pitch axis


Code Samples

On the server side of the entity templatemount script, add the registration of this type of entity when logging into the gameCallback, create a dynamic map of map001 and transfer the object to the map

Trigger.addHandler(this:cfg(), "ENTITY_ENTER", function(context)
    local player = context.obj1                                         --Get the logged in object instance
    local dynamicMap = World.CurWorld:createDynamicMap("map001", true)  --Create dynamic maps 
    player:setMapPos(dynamicMap, Lib.v3(27,4,33))                       --Set player map and coordinates
end)