Adjust entity movement threshold and follow behavior
Increased the movement threshold for entity updates from 0.05 to 1.0 to reduce unnecessary position updates. Modified follow behavior to offset the entity's coordinates by -1 on the Z axis when updating, possibly to account for ground level or animation adjustments.
This commit is contained in:
1 parent
dd08f058c3
commit
cb9dbdf610
2 files changed
+2
-5
No files matched your search
@@ -8,9 +8,6 @@ ClientEntity = {
|
||||
} -- Renamed from BaseEntity
|
||||
ClientEntity.Behaviors = Behaviors
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------
|
||||
|
||||
local function SpawnEntity(entityData)
|
||||
@@ -81,7 +78,7 @@ local function UpdateEntity(_entityData)
|
||||
local coords = vector3(entityData.coords.x, entityData.coords.y, entityData.coords.z)
|
||||
entityData.oldCoords = vector3(entityData.oldCoords.x, entityData.oldCoords.y, entityData.oldCoords.z)
|
||||
local dist = #(coords.xyz - entityData.oldCoords.xyz)
|
||||
if dist > 0.05 then
|
||||
if dist > 1.0 then
|
||||
if entityData.spawned then
|
||||
print("Moving entity:", entityData.id)
|
||||
SetEntityCoords(entityData.spawned, coords.x, coords.y, coords.z, false, false, false, true)
|
||||
|
||||
@@ -42,7 +42,7 @@ function Follow.PedWalkToPos(entityData)
|
||||
TaskGoStraightToCoord(entity, targetCoords.x, targetCoords.y, targetCoords.z, speed, -1, heading, 0.0)
|
||||
entityData.coords = GetEntityCoords(entity)
|
||||
entityData.follow.walking = true
|
||||
Bridge.ClientEntity.Set(entityData.id, "coords", entityData.coords)
|
||||
Bridge.ClientEntity.Set(entityData.id, "coords", entityData.coords - vector3(0,0,1))
|
||||
Bridge.ClientEntity.Set(entityData.id, "follow", entityData.follow)
|
||||
if entityData.follow.OnExit then entityData.follow.OnExit(entityData) end
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user