BodyGyro substitute that will still turn an object smoothly

Hello!

Currently, I’m working on a Nascar game and have been having issues with the BodyGyro that i use to turn the car. The car turns extremely nicely, perfectly I would say. The only issue is that BodyGyro is too rigid.

What I mean by this is simple, if someone were to hit their car into the side of yours, it wouldn’t even so much as budge. This is because of the torque on the Y-Axis, the problem is I cannot remove that as I need the torque to turn.

I’ve tried BodyAngularVelocity because I know that if it turns my car it would work and let physics happen, but no matter how much power or torque I give it hardly nudges my car.

Any suggestions/substitutes or fixes for my problem?

1 Like

Try this: BasePart | Roblox Creator Documentation.
Then check if the user is pressing a or d every Heartbeat and use :ApplyAngularImpulse(). Not sure if this will work however.

1 Like

Interesting, ill look into it and try it, thanks

why would you check input with Heartbeat? Using Heartbeat increases unnecessary activity. UIS.InputBegan and ContextActionService exists so use those instead

1 Like

Is there any merit to using a vehicleSeat’s steer property? I heard that VehicleSeats are deprecated somewhere but its worked pretty well for me as long as I’m not trying to make a constraint-based car controller

Because instead of doing:

UIS.InputBegan:Connect(function(key)
     if key == steerkey then
          while turning do
                wait(0.5)
                turn()
          end
     end
end)

you do this instead:

local Timer = 0
RunService.Heartbeat:Connect(function(delta)
    Timer += delta
     if UIS:IsKeyDown(steerkey) and Timer > turn_speed then
           turn()
           Timer = 0
     end
end)

Last time I checked, VehicleSeats aren’t deprecated.

I control the car over the server similar to this


seat:GetPropertyChangedSignal("Steer"):Connect(function()

end)

What would be doing it with UIS be better than doing it with the changed signal, from my understanding they’re both events and do the same thing?

There’s no issue with that, but you said that when cars hit the side of other cars they don’t move. So I suggested you use :ApplyAngularImpulse() as an alternative to BodyGyro.

Also you shouldn’t be doing the steering on the server, it causes input delay.

Oh really? I didn’t know that, ill have to change that then.