I’ve been developing some vehicles for my upcoming game, Demolition Crew, and I’m experiencing strange collision issues. Sometimes after using a vehicle, players are thrust out of the cockpit and are violently pushed away if they attempt to jump inside. I’m relatively new to developing vehicles and I have no idea what is going on. Any ideas or suggestions? Thanks!
Fairly common issue.
Setting the network ownership to the the player usually solves any issues.
I see. I added this line of code for when you first enter the vehicle, with script.Parent being the vehicle seat:
Unfortunately, I’m still experiencing issues with the vehicles.
I also used SetNetworkOwnerShipAuto() for when the player exits the vehicle. Is there anything else I should check for or do?
I did some more tinkering and it seems making the vehicle not parented to the player once the player exits fixed the collision issue.
I’m actually having the same issue. Are you using PGS? I’m not on PGS, but the cars are parented to the character and the player’s flung whenever they touch the car, or even sometimes when the car’s touched by something else. It has to be coming from parenting or PGS because if you said network ownership didn’t work, those are the only other 2 things our vehicles have in common.
Side note: Our cars are using ball-shaped wheels with non-mesh bodies. Usually they’re <200 parts but really they’re just in that range somewhere.
Edit: Could this be a bug report? In your second gif, the wrecking ball physics seem to be applying to your character.
I thought it was the wrecking ball for a while as well. I removed the entire top half of the vehicle and I still had the same issue of players being pushed before I changed the parenting.
As bigcrazycarboy mentioned, I would recommend narrowing this down to a simple repro file and using the post approval process (see 15.1 of this thread) to post a bug report. This definitely doesn’t seem like intended behavior of the pgysics engine.
Been there. Done that. The report got no real attention even though it’s been a clear on-going problem for quite some time now.
I very highly recommend not putting anything into your player’s character unless it is part of their character. There are many odd bugs with weight and movement and etc that all happen because of this. Have you tried to just copy a local script to their character or something instead? You can also get the vehicle via humanoid.SeatPart and get the driving humanoid via humanoid.Occupant if you are using a VehicleSeat.
The point of the script is to delete the car when the user dies or leaves, and also because then when the regen script goes to clone the car, it makes a brand new version of it so the same car can be replicated multiple times, rather than a regen that regens the car via deleting the current one.
Yes but you can do that by binding to PlayerRemoving or Humanoid.Died (remember to remove the binds later just in case) and you do not need to put it in the character. It is unnecessary and unnecessarily glitchy imo. You can still transfer data from the car by reading before/after its destroyed (preferably before).
I actually, right after I finished my message to you, started working on a system myself.
Basically, I removed cars for PlayerRemoving. And then also, when the player gets in the car, it remove it from the regen model, parents it to the workspace, and then renames it to (PlayerName)Car so it can be found easily by the Player Removing script. Then if a player gets into a second car, it’ll check to see if they own any other cars and delete their old car. So, this prevents a player from having more than one car, but also then I don’t have to check for a character to die and then delete their car.