I have a car script, and I’m trying to make it so that it has a collision block around it to prevent the car from crashing into surfaces and bugging out.
I current have this part attached to my car to serve as a hitbox however the weight of the part is making my car unfunctional. I’ve tried to do multiple things like make the part massless and set custom physical properties however it still slows my car down:
Try making two collision groups. One for the vehicle (only collides with the map or player [Would require you to set players collision groups when character loads]) and another collision group that only collides with the map. The first is what you could set the entire vehicle besides the hitbox to, then the other just for the hitbox.
what if I set all the parts inside of the car to have a “nocollisiongroup” object set to the hitbox? Also I am going to determine if its weight related by making the part really tall on the Y axis and seeing the differences
I want my cars to be “ready to go” rather than having to track different equipted cars and manually setting collision groups or worry abotu code executing too slow during run time. for this reason I will be utilizing the “nocollisiongroup object” so I dont have to track equipted cars
Yep, just make a for loop that checks all cars descendants for any baseparts then change their collision group to whatever you set
Example: In this example I’m assuming each car is within workspace, has a Chassis folder within, and that your new collision group is named Car
for _, car in game.Workspace:GetDescendants() do
if car:IsA("Model") and car:FindFirstChild("Chassis") then
for _, part in car:GetDescendants() do
if part:IsA("BasePart") then
part.CollisionGroup = "Car"
end
end
end
end
Massless works fine, this seems more like a collision issue - Noticeable by the affect it has to the physics and how it also seems to have pushed the car body from the wheels/chassis
actually instead of assigning a collision group, I am going to simply set all the other parts of the car to “cancollide false”, with the hitbox being the only collosion object (outside of wheels)