Hi. In the prototype below, when I crash into an object, the vehicle jitters a lot. I am looking to achieve collisions like this where when I crash into something, the vehicle just “pauses”.
Here is the code for the prototype. Any help is appreciated!
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Plane = workspace.Plane
local Camera = workspace.CurrentCamera
RunService.RenderStepped:Connect(function()
local CameraCFrame = Camera.CFrame
Plane.BodyVelocity.Velocity = Mouse.Hit.LookVector * 100
Plane.BodyGyro.CFrame = CFrame.new(CameraCFrame.Position, Mouse.Hit.Position)
end)
After some advice from Orange12345 (thank you), I was able to solve this.
I first tweaked the BodyGyro to have infinite torque, then I set the BodyVelocity to have a decently high value, but not infinite. Lastly, I set all objects apart of the vehicle to have Massless set to true, and then I set a single root part to have Massless set to false (this root part was the size of the entire model). If you want players in your vehicle, then you will also have to set their limbs to have Massless set to true when they enter the seat. Note that the root part can have CanCollide set to false.