altmp / altv-issues

Issues and roadmap for alt:V project
93 stars 17 forks source link

Attaching players to another entity isn't properly synced #805

Closed GVMP closed 3 years ago

GVMP commented 3 years ago

Client/server version All current versions

Current behavior For the local player: https://i.gyazo.com/5454a8ae92ef649bb46ea2aefe8c8543.mp4

For all other players: https://i.gyazo.com/4bfde6a5e3e6530dabe0142a0389b134.mp4

Expected behavior Behaviour should be the same like for local player

Steps to reproduce Attach localplayer to a vehicle with attachEntityToEntity. For the localplayer it works perfectly. Any other player will see the player bug through the ground. The collision is disabled, otherwise the player can collide with the vehicle itself. Anyways, for the localplayer does it work with collision off.

Example: native.attachEntityToEntity(localPlayer.scriptID, vehicle.scriptID, 0, 0.1, -1, 0.3, 0, 0, -90, false, false, false, true, 0, true);

Context (environment) Carrying player and dropping them. Attach player to vehicle interiors like the foodtruck.

Possible solution Sync it properly. Would save me alot of beer. Less beer to spend, more money for Diamond Patreon.

tastydev commented 3 years ago

You disabled the collision of the attached player so this is a kind of normal behaviour in a physical way. The remote client calculates that the attached entity is falling under the ground due to the collision loss while alt:V in syncing it´s position back through rpc. (maybe still a bug but i am pretty sure this bug will disappear if collision in native call is enabled)

GVMP commented 3 years ago

The collision is disabled, otherwise the player can collide with the vehicle itself. Anyways, for the localplayer does it work with collision off.

So it's a bug.

FabianTerhorst commented 3 years ago

Did you override net owner?

GVMP commented 3 years ago

No. No need to override the net owner manually.

FabianTerhorst commented 3 years ago

yes ofc its needed. You modify the sync state of the other player as well when you attach yourself.

GVMP commented 3 years ago

Still no need to change the net owner manually. AltV should handle this for altv entities by itself.

FabianTerhorst commented 3 years ago

since we have a serverside attach api now that keeps care of that stuff i will close this issue.