-- Settings local HILL_START_POSITION = Vector3.new(0, 50, 0) -- Top of hill local STEER_SPEED = 10 -- Turning speed local MAX_STEER_ANGLE = 30 -- degrees local ENGINE_POWER = 0 -- 0 = pure gravity, >0 adds throttle
You must apply a (or BasePart with physics enabled) to the car for it to gain speed from gravity.
float slopeAngle = Vector3.Angle(Vector3.up, groundNormal); float downhillBonus = Mathf.InverseLerp(0, 50, slopeAngle); // 0 to 1 between 0° and 50° float totalForce = motorForce + (downhillBonus * motorForce);
# Stop if it hits the bottom of the screen if new_y < -250: break