Developer knowledge network · moderated exchange

Супольнасць UnreliableCode

Супольнасць распрацоўшчыкаў даследаванняў, зваротнага праектавання і кадавання

Knowledge indexжыць
4Categories
919Threads
2.8KПаведамленні
Release

Safe Teleportation routine with terrain collision loading (LOAD_SCENE)

fivem_native_guru
CitizenFX Dev
MEMBER
прадстаўнік: 182
Дата далучэння: May 2021
Паведамленні: 8
Дзякуй: 69
1 месяцаў таму · Jul 12, 2026 12:08 AM
#1

When teleporting across long distances in GTA V, player models often fall through the map because ground collision meshes haven't streamed in yet.

Safe Teleport Sequence:

CPP
void SafeTeleport(Ped ped, Vector3 coords) {
    // 1. Request collision mesh streaming
    STREAMING::REQUEST_COLLISION_AT_COORD(coords.x, coords.y, coords.z);
    NEWLOADSCENE_START_SPHERE(coords.x, coords.y, coords.z, 50.0f, 0);
    
    // 2. Teleport entity
    ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ped, coords.x, coords.y, coords.z, 0, 0, 1);
    
    // 3. Freeze entity while scene finishes loading
    ENTITY::FREEZE_ENTITY_POSITION(ped, true);
    ScriptWait(100); // 100ms yield
    ENTITY::FREEZE_ENTITY_POSITION(ped, false);
}
vtable_slayer
Senior Reverser
MEMBER
прадстаўнік: 215
Дата далучэння: Mar 2018
Паведамленні: 86
Дзякуй: 61
1 месяцаў таму · Jul 12, 2026 2:23 AM
#2

Freezing entity position for 100ms while calling REQUEST_COLLISION_AT_COORD completely prevents falling into the void.

fivem_native_coder
Lua Scripter
MEMBER
прадстаўнік: 64
Дата далучэння: Jun 2019
Паведамленні: 20
Дзякуй: 48
1 месяцаў таму · Jul 12, 2026 4:55 PM
#3

Works on high-speed FiveM RP servers with custom map assets.