smallg, it work but the entity following me, fall too slowly !
ALSO when the entity is close to me, the entity fall on the ground like dead, it come from the physics friction, if i put it to zero the entity doesn't fall anymore but when the entity is close to the player it keep turning around the player 360°
thanks to everyone for the help
this is my code:
local moveSpeed = 1000
local followDist = 200
local maxWeight = 100
GravityOn( e )
function follow_player_init( e )
end
function follow_player_main( e )
local Ent = g_Entity[ e ]
local px, py, pz = g_PlayerPosX, g_PlayerPosY, g_PlayerPosZ
local PDX, PDY, PDZ = Ent.x - px, Ent.y - py, Ent.z - pz
if PDX*PDX + PDY*PDY + PDZ*PDZ > followDist * followDist then
CollisionOff( e )
RotateToPlayerSlowly( e, 50 )
MoveUp(e,-100)
CollisionOn( e )
MoveForward( e, moveSpeed )
MoveUp(e,-100)
end
end
My Portfolio: https://www.mattepainting.be/
My FREE extension: https://www.stop-it.be/