I have a traffic script for a car I got from a free model. Basically it makes the car turn when the waypoint isn’t in front of the car
The car system I am using is the roblox one from the Racing Template and so it uses PrismaticConstraint which can go to max 1 and the code I am using has 90 for hinge constraint.
I tried for about 1 and a half hour and nothing.
Goal1 = Car:FindFirstChild("Target").Value
local PositionDifference = (Goal1 - FrontVector.Position).Unit
local GoalFrontVector = FrontVector.CFrame.LookVector
local DotProduct = PositionDifference:Dot(GoalFrontVector)
local Angle = DotProduct
local TargetAngle1 = math.deg(math.acos(Angle))
local TargetAngle = TargetAngle1 - 90
Steering, I did print it and tried everything. The steering itself works but it always has the steering very sensitive as the steering is mostly about 10 when it should be like 0.1 or something. The problem is I don’t know how to make it be around -1 to 1. It’s hard to explain lol
I don’t understand what you mean by the PrismaticConstraint has a max of 1?
If it’s got a 1 stud movement range you could try moving the Attachment further away from the steering hinge to decrease the angle.
The other thing if the angle is 10x what you’re expecting you can multiply the angle by 0.1 in your calculation.
Also forgot to tell, math.rad works but it cannot go right as it cannot do the numbers in negative, neither diving works as it’s the same as with math.rad.
If you want a number range to calculate between 0 and 1 then divide by the number.
For example you want 90° to be represented as 1 then 90/90 = 1. That way if it’s halfway 45/90 = .5
Same as distances. Divide your actual distance by the max distance you expect it to be limited to.
You said the Prismatic moves the wheels, but that’s still a vague answer because it could still be suspension or steering related.
It really helps if you are really specific because people reading these posts might assume you mean one thing instead of what you actually mean. It’s better to say “The PrismaticConstraint steers the front wheels”.
If you want you can send me a stripped down model of the car here or by private message and I can have a look at it tonight.
Nvm the problem was with the “FrontVector” part as it wasn’t really FRONT and I had to divide in another line than the “local TargetAngle”. Thanks for the help anyway lol