Hey i would really like to spawn my vehicles serverside with CreateVehicleServerSetter. Currently, I’m still using clientside spawning, because it preserves body deformation. However, when using CreateVehicleServerSetter, it seems to reset the vehicle (deformation) if you’re far away.
To reproduce it: spawn a vehicle with CreateVehicleServerSetter, damage the vehicle body, leave your OneSync Infinity bubble, then return to the bubble where your vehicle is located. The result is, that the body deformation completely resets. Currently, it only sets parts like doors and windows correctly.
I know it’s not a bug. It’s just how the native works, because the vehicle simply respawns when the player is nearby. Unlike client side spawning, the vehicle stays for the owner, even if the owner is far away. But maybe there is a way to save the body deformation and set it back to the vehicle. Something like this script does: GitHub - Kiminaze/VehicleDeformation
There exists a native called CopyVehicleDamages - FiveM Natives @ Cfx.re Docs that can copy all damage to another vehicle. I personally have not yet worked with it, but I would assume that this data can somehow be intercepted and used if someone has the knowledge to do so.
CopyVehicleDamages looks more like a native to copy the basic things that are attatched to a bone like doors, bumpers. At least thats what it describes.
SetVehicleDamage can be used to set the body deformation. But you still have to save and set it with a script and its still not the perfect way to do it.
I know that there will never be a perfect body deformation sync (Rage Engine limitation), but it would be nice, to implement a decent deformation sync for server spawned vehicles.
Im now saving/updating the whole vehicle like engine health, doors, windows, body damage as a statebag, but i had to edit all my vehicle-spawn/repair/tuning resources + framework to get this working. It finally syncs all my serverside spawned vehicles, even when reconnecting. Just have to test it with a lot of players on the main server. So it looks like that statebags with vehicle properties & deformation are the whole fix for this.
Hey Csyon was genau hast du alles umgeschrieben, haben das Problem das manche Fahrzeuge einfach kaputt dargestellt werden und bei anderen Spieler nicht