Roblox Jeep improvements? Acceleration , slowing down

Hey, its me janik.
I already made multiple topics regarding vehicles but none really helped me.
I am scripting LUA for 6-7 years now and I’v never done anything related to physics and I am currently in heavy developing of my game with a team.
We need vehicles, cars and helicopters ( maybe planes but thats another story ) and I dont want those stupid A-Chassis free model very detailed physics cars.
I want a car that behaves like the default Roblox Jeep or Jailbreak cars, I dont know if the jailbreak cars also drive via BodyMovers but I really really like those.
I tried messing around with the jeep to improve it, because it has multiple problems.
First thing is the steering, it is kinda weird.
Next thing is that it instantly reaches max speed, so there is no acceleration value to tweek.

Is there any Link, Help, Suggestion or smth else to get me started in the right path?
I am thankfull for every help!

6 Likes

See this post,

1 Like

I saw this post multiple times but they only go on about the suspension, which is pretty identical to the roblox default jeep.
I need to know how to get it to drive

1 Like

I’m not too good with vehicles, sorry

1 Like

you could always use the tweening service

2 Likes

you can literally go through the starter jeep made by roblox and use its script for cars…etc

1 Like

You can use BodyVelocity for acceleration. In terms of Equations you can assign .P of CFrame calculated in standard jeep.

It would probably look like this:

BodyVelocity.Velocity = BodyVelocity.Velocity + CFrameFromJeepScript.p

For it not to accelerate infinitely you should add this:

BodyVelocity.Velocity = BodyVelocity.Velocity - BodyVelocity.Velocity/MaxVelocity

Note: MaxVelocity is actual number BodyVelocity will never Reach but will try to get to as much as it can

I don’t know about steering, since I don’t have time to look into it at the moment).

1 Like

Like I said, The starter jeep has its problem and I am trying to find a way to fix them here, example: Acceleration.

1 Like

Alright, with your second Line of code it started slowing down after I stopped pressing W.
So the normal acceleration doesnt work, it just slows down if I dont press W.

1 Like

This link will guide you to the right path of creating your own vehicle, as it demonstrates how constraints work. Basic, but important for beginners. Just vehicles though, but a head start.

1 Like

This will give you a car that feels a bit different from the Starter Jeep, but being this car is more physics based, you will be able to customize how it drives & feels much easier through changing values like Torque or Tire Frictions.

https://developer.roblox.com/en-us/articles/building-carkit-1

3 Likes

BodyVelocity should give yo acceleration by itself, are you using bodyVelocity?

1 Like

i do not recommend using Raycast vehicles since they do not handle nicely on lower end devices instead i recommend using a vehicle out of constraints

1 Like

ive written this for Acceleration and Deceleration on the jeep

first of call create new values in the car,

one for current speed, one for maximal speed, another for the amount of acceleration being added, in a loop you wanna create in the local disabled script (i made a while true do above the heartbeat:Wait() loop with a coroutine and debounce), you could constantly add the acceleration to the current speed, you have to replace every “Speed” in the script with your current speed value, and only add the acceleration to the current speed, as long as currentspeed doesnt superseed the Maximum speed,

Then you can DotProduct the lookvector of your car, with its Velocity.Magnitude, check if the velocity is getting lower and set it high agauin once it goes below 0 or something like that,

tiny bit of code samples:

--acceleration
			if currentspeed.Value <= TopSpeed.Value then
				currentspeed.Value += Acceleration.Value
			end
--velocity with positive and negative values
car.Parent.CollBox.CFrame.LookVector:Dot(car.Parent.CollBox.Velocity)

and aswell set the current speed lower everytime the car stops getting input, hope it helped, and good luck!

sorry for the 2 year later bump

you might be fine with just using normal velocity, not sure if you’ll need that positive netgative velocity, might be useless complication

edit:
actually i just remembered vehicle seats have throttle with -1 and 1, just set the acceleration lower as that changes or something