I am trying to stop my car from shaking and acting weird when adding parts other than the chassis components (as shown in the second video below)
When I drive the car normally, with just the chassis, it works fine:
The issue is when I start adding any other parts to the body of the car. The car starts shaking and the wheels aren’t turning properly (compare to the first video)
I have a car and a chassis model (holding all the practical components)
The selected objects here are the wheel Attachments:
Each Wheel Attachment is welded to the frame.
The 2 front Attachments are attached to the front Wheel Hinges (for steering)
The 2 rear Attachments are attached to the rear Wheels
Below is the chassis frame, every wheel attachment is welded to it:
This is the front Wheel Hinges, they are attached to the front wheel attachments (in the first image):
These are the wheels. They have NoCollisionConstraints attached to the frame (so the wheels don’t collide with the frame of the chassis). Theres also a script applying CustomPhysicalProperties to each of them.
The front wheels are attached to the wheel hinges
The back wheels are attached to the back wheel attachments.
The script I have also sets the TargetAngle and AngularVelocity for the front Wheel Hinges (for steering and throttle)
Configuration Script
local cfg = {} -- Config
-- Values
cfg.Speed = 30
cfg.ReverseSpeed = 15
cfg.SteerAngle = 30
-- Physics
cfg.PhysicalProperties = PhysicalProperties.new(
0.2, -- DENSITY 0.01 to 100.0 default - 0.7
1.72, -- FRICTION 0.0 to 2.0 default - 0.3
0, -- ELASTICITY 0.0 to 1.0 default - 0.5
1, -- FRICTION_WEIGHT 0.0 to 100.0 default - 1
0 -- ELASTICITY_WEIGHT 0.0 to 100.0 default - 1
)
-- Instances
cfg.Wheels = {}
cfg.Steering = {}
cfg.Seat = script.Parent.Seat
for i,Wheel in pairs(script.Parent.Chassis.Wheels:GetChildren()) do
cfg.Wheels[Wheel.Name] = Wheel
end
for i,Steer in pairs(script.Parent.Chassis.Steering:GetChildren()) do
cfg.Steering[Steer.Name] = Steer
end
return cfg
The script under the configuration script
local cfg = require(script.Parent)
-- Values
local TurnAngle = cfg.SteerAngle
-- Instances
local Wheels = cfg.Wheels
local Steering = cfg.Steering
local Seat = cfg.Seat
Seat:GetPropertyChangedSignal("Steer"):Connect(function()
Steering["FLHinge"].Steering.TargetAngle = TurnAngle * Seat.Steer
Steering["FRHinge"].Steering.TargetAngle = TurnAngle * Seat.Steer
end)
Seat:GetPropertyChangedSignal("Throttle"):Connect(function()
local v = 0
if Seat.Throttle>0 then v = cfg.Speed elseif Seat.Throttle<0 then v = cfg.ReverseSpeed end
Wheels["FL"].WheelConst.AngularVelocity = v * Seat.Throttle
Wheels["FR"].WheelConst.AngularVelocity = v * -Seat.Throttle
Wheels["RL"].WheelConst.AngularVelocity = v * Seat.Throttle
Wheels["RR"].WheelConst.AngularVelocity = v * -Seat.Throttle
end)
for i,v in pairs(Wheels) do -- Changing physical properties of all 4 wheels according to the config
v.CustomPhysicalProperties = cfg.PhysicalProperties
end
In this case, the red part (which is the only part of the car Body) is welded to the chassis frame. Its not anchored, has CanCollide, CanTouch and CanQuery OFF. So it shouldn’t collide in any way with any parts… Even when putting it high in the air so it’s attached but doesnt touch anything it still happens.
Normally I’m able to find solutions to such issues, but this time I’m not even sure how to describe it, which is why I’m here.
Thanks in advance for any help! Let me know if any additional information is needed. I can provide the model if necessary.