Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

How to incorporate centripetal force into my cars body force?

Asked by 6 years ago
Edited 6 years ago

So I have a car I'm working on. It has suspenion and all that and I'm propelling it with body thrust and turning it with body angular velocity. My problem is that the car drifts a lot when turning. Hers a GIF: https://gyazo.com/7443aaffe0735d94207e8a84c86c05d2. So in my script this is what used to control the car:

local Speed = Chassis.Velocity.Magnitude
BodyThrust.Force = Vector3.new(0,0,Power * Movement.Y - (Drag * Speed * Movement.Y))
BodyAngleVelocity.AngularVelocity = Vector3.new(0,Movement.X,0)

The Movement.Y is the throttle and the Drag and Power are constants. I found this dev forum post(https://devforum.roblox.com/t/bodyforce-causes-my-car-to-drift/137524/2) about it with a guy saying to use centripetal force to make it not drift. He gave this eqaution: CentripetalForce = mass * linearVelocity * angularVelocity

So theres a few things I have questions about with this. First off I don't understand what the linear velocity is or how to get it. The person described it as being the velocity of the lookVector so I assume it is a Vector but I don't know. I also am not sure if angularVelocity is a vector or the Y part of the angular velocity. And finnaly I don't know how to apply the centripitalforce to the my bodythrust.

This seems complex to the other questions I usually see on this site so any help would be appreciated.

0
AngularVelocity is how fast an object is spinning (rotation), linear velocity is how fast an object is moving (translation). Velocity is by default expressed using vectors (which can encapsulate both speed AND direction), and you can isolate just the speed component by finding the Magnitude of the vector through .Magnitude thebayou 441 — 6y
0
Correction: Linear velocity is " the velocity of the object travelling in a straight line ", so I'm guessing what the person probably means is how fast its traveling in the lookvector thebayou 441 — 6y
1
I haven't tried this, but can you get the linear velocity by dividing the part's velocity by its lookvector? idk, try it out thebayou 441 — 6y
0
Yea thats what I was trying to do. I'm thinking you might use :vectorToObjectSpace() but i dunno. Wafflecow321 457 — 6y
View all comments (3 more)
0
just try anything that comes to mind and see thebayou 441 — 6y
0
Wait so the outcome the centripetalforce variable, should that be a float or a vector and how do I apply that to the other vector that is being applied to the thrust Wafflecow321 457 — 6y
0
I think if it's vector then you could directly apply it in a separate bodyforce. If it ends up as a float then it should be applied towards the center of rotation (the centerpoint of the circle outlined by the turning car if it drove one whole revolution) thebayou 441 — 6y

Answer this question