So I am trying to make a car face a specific direction using the ROBLOX Chassis, however I have no idea where to start. I was able to find the angle that is needed to face the goal position, but I don't know how to make the car face the angle. Any help is appreciated!

The Code :

while wait(1) do
	local target = workspace.Goal.Position
	local pos = script.Parent.Parent.Body.PrimaryPart.Position
	local Chassis = require(script.Parent:WaitForChild("Chassis"))
	local currentVel = Chassis.GetAverageVelocity()
	local seat = script.Parent.Parent.Chassis.VehicleSeat
	
	local rot = math.atan2(target.Z-pos.Z,target.X-pos.X)
	local angle = math.deg(rot) + script.Parent.Parent.Body.PrimaryPart.Orientation.Y + 90
	
	if angle > 180 then
		angle = -(angle-360)
	elseif angle < 180 then
		angle = 360+angle
	end
	

	Chassis.InitializeDrivingValues()
	Chassis.Reset()

	Chassis.UpdateThrottle(currentVel, 1)
	Chassis.UpdateSteering(angle, currentVel) --Here is where the problem lies.
end

2 comments

0

What do you mean by face direction like are you meaning how to rotate from a script??

0

Face a given direction is what I meant