Hi, I’ve been coming across some issues with my raycast car
What do I want to achieve?
Implementing sliding friction into a raycast car so that it does not slide sideways. (Perpendicular to each thruster)
What is the issue?
The car spins out of control if I turn too much. You can see it in this video below:
(Note: If you have difficulty loading the video, try opening it on youtube)
What solutions have I tried so far?
I have searched the forums for a possible solution, and while there are some topics similar to mine, their solutions have not worked out for me. I believe that my system is very close to working, but there’s something small preventing it from working.
Upon extensively testing my own system and visualizing the vector forces, I believe it’s a direction problem and not related to magnitude of the force. Decreasing and increasing the mass or grip factor only makes the spinning faster or slower. In my video, you can see that as soon as the vector force arrow points backwards, that’s when the spin happens. Also, I am using torque to turn/steer the car.
I would appreciate any help or guidance. If you need more information, let me know.
Yo! I saw this tutorial in February and got tempted to try it. I always wanted to try making a Raycast car because of some issues I had with constraint ones. But anyway.
I had to make some changes because it didn’t work with VectorForce, for some reason. It also is not perfect.
This is one of the reasons why I prefer constraint chassis because I only have to deal with physics in a practical and somewhat realistic way. No calc.
The code I’m using:
local VelocityUnit = (SpringPosition.Magnitude > 0) and SpringPosition.Unit or Vector3.zero
local RollingFriction = Raycast.Normal.Magnitude * script:GetAttribute("TireGrip") * -VelocityUnit
VehicleRoot:ApplyImpulseAtPosition(Vector3.new(RollingFriction.X, 0, RollingFriction.Z), WorldPosition)
Hello, It is me again. Can you explain what you VelocityUnit is, and you spring position? Is that the position of the wheel, or the length of the spring as a vector. I’m trying to work with the math and experiment on my end. Thank you in advance.
So I managed to solve this issue. It seems almost silly now. All I had to do was change the property of the vector force to be relative to the attachment rather than the world.