Hi, so I am wondering how you can instantly stop the speed of a vehicle without needing its de-acceleration, just instantly stop it so that I can prevent the vehicle from travelling on terrain-types that don’t make sense.
So really, and simply my question is how do I immediately stop a vehicle that is using VehicleSeat- the best I can find is MaxSpeed but that doesn’t make it stop going once it hits a certain velocity! Thank you.
local ResetVelocity = function(Model)
for Number, Instance2 in pairs(Model:GetDescendants()) do
if Instance2:IsA("BasePart") then
Instance2.Velocity = Vector3.new(0, 0, 0)
Instance2.RotVelocity = Vector3.new(0, 0, 0)
end
end
return
end
Impulse = Change in velocity * mass. You can use BasePart.AssemblyLinearVelocity and BasePart.AssemblyMass to get the values needed.
The equation should look something like this:
local basePart --A BasePart of the car/assembly
--Stops the car/assembly:
basePart:ApplyImpulse(-1*BasePart.AssemblyLinearVelocity*BasePart.AssemblyMass)
Did you call the function and put your vehicle in the parenthesis like this?
local ResetVelocity = function(Model)
for Number, Instance2 in pairs(Model:GetDescendants()) do
if Instance2:IsA("BasePart") then
Instance2.Velocity = Vector3.new(0, 0, 0)
Instance2.RotVelocity = Vector3.new(0, 0, 0)
end
end
return
end
ResetVelocity(Put Your Vehicle Here)
(I think the velocity property is read only so it can’t be changed.)
Personally, applying a force opposite of the current force should set the velocity to zero, ofc that’s according to Newton’s laws.
Setting the velocity to zero would not work due to motion already occurring, it’s like trying to stop a car going 50mph, you can unless you have a reaction with the same amount of force to equal zero.
Car.Velocity = -Car.Velocity
Now if you didn’t want to do this, anchoring the part prevents any movement whatsoever; this would work yes, however, you would need to unanchor it later to apply any valid movement/physics to the object.