Vehicle & Character Physics

Hello,

I’m looking to fix a problem I’m currently having between vehicles and characters, and their physics.

Right now, whenever the character exits the vehicles (even with the “parking brake” enabled) the character can hop out and easily push the vehicle by running into it…

Example

https://media.discordapp.net/attachments/234077451402084352/655842065359568916/rntmTRUPsA.gif?width=1044&height=676

Any suggestions on how to disable this?

5 Likes

Anchor the base of the vehicle/entire vehicle, remove velocity of the car if needed. Detect when and if a player is sitting/inside the car, if so, proceed to unanchor and let the player move the car. Do the same thing vice versa if needed ;3

3 Likes

Thank you, I’ll give that a try!

Why not try:

On YourJumpEvent do
car.Anchored = true
end

Something along them lines.

3 Likes

@DragRacer31 Alternatively, on parking brake applied?

Thank you, I’ll try this option out too!

I don’t understand why you mention / ping me?

As for your issue, assuming your car chassis is made with constraints you can just mess with Wheel.CustomPhysicalProperties.Friction, and set it to a higher value (You will have to do this manually to each wheel, the line of code that I have shown here won’t work in a script).

3 Likes

Increase the weight of the car and increase the friction coefficient of the tires. In real life, you can’t push a car manually because of the friction from the tires, not because it is “Anchored”.

3 Likes

Hi, you could try giving the vehicle weight via Density in one part, called the center of mass and have every bodykit piece have no mass.

6 Likes

Just tried this, seems like for some reason when the vehicle is unoccupied (no one has sat in it at all yet) it works for the most part, making it hard to push. But as soon as someone sits in a seat within the vehicle, it just resets it back to like .1 and it moves like it’s paper in the wind again. This also makes the vehicle near impossible to turn at certain limits when going “slower.” Might just have to mess around with it some more.

Trying this out too, so far it seems to have a slight impact, but it also slows the vehicle down the crazy in acceleration. Another thing I might just need to mess with some more.

Thank you all for your help, any further tips - please do let me know! I’m going to keep testing this out, determined to make it work! :smiling_imp:

2 Likes

It’s been a while, 11 months to be specific, and sorry for the bump, but have you had any luck finding a solution to it? If you’re using A-Chassis, it’s an issue I and several other of my friends who use A-Chassis have had for a while, even with the newest version of A-Chassis. A semi-solution is to increase friction or just anchor the car, but like you said, as soon as someone sits back in the driverseat, the properties reset and the car is back to being light as a feather. It would really be helpful if you could let me know if you’ve found an alternate solution to it, or if anyone else has found a solution to it.

I’m currently looking for a soulution for this too. My buses use A-Chassis and I do use an anchor handbrake via a lever in the cab. Two problems with it are that 1: the vehicle needs to be at a complete stop before it can be applied (normally I use the AC “handbrake”) otherwise people inside will slide forward due to the velocity of the parts still being as they were prior to the anchor brake being applied. And 2: If you apply the anchor brake and exit the DriveSeat. If you try to sit back down with the anchor brake applied the core chassis script will throw an error due to it trying to set the network ownership on the anchored handbrake part. As a result you need to release the anchor brake before you can sit in the drivers seat.

I today have been trying to rescript the brake to use BodyVelocities and BodyGyros to hold it in position but I find I can STILL push the vehicle around even with a super high setting on it.

2 Likes

Try this script in the seat of the car:

local seat = script.Parent

seat.Changed:Connect(function()
  if seat.Occupant ~= nil then
    seat.Anchored = true
  else
    seat.Anchored = false
  end
end)