the current code i have will rotate the auto pilot car but it rotates the wrong way in comparison to the players car turning direction and tends to freak out when the player is facing south.
Code: Select all
global.left_car.orientation = global.car.orientation
local degrees = global.car.orientation*360
local rad = (degrees*(math.pi/180))*-1
local left_car_pos
local old_x = global.left_car.position.x
local old_y = global.left_car.position.y
local pivot_x = global.car.position.x
local pivot_y = global.car.position.y
old_x = old_x - pivot_x
old_y = old_y - pivot_y
local left_x = (old_x*math.cos(rad) - old_y*math.sin(rad)) + pivot_x
local left_y = (old_x*math.sin(rad) + old_y*math.cos(rad)) + pivot_y
left_car_pos = {left_x,left_y}
global.left_car.teleport(left_car_pos)
global.left_car.speed = global.car.speed