Fix brake location calculation; was applying it to the wrong spot.
This commit is contained in:
		| @@ -170,14 +170,14 @@ function constraints:constrain(s, want) | ||||
|  -- bmx: brake max | ||||
|  local v1, bmx = calc_velocity(s.dx, want, s.maxspd, s.drag), s.thrust + s.drag | ||||
|  local bd, bf = brake_dist(v1, bmx) | ||||
|  local bx, txm = s.x + bd, self.xmax | ||||
|  local bx, txm = s.x + bd + v1, self.xmax | ||||
|  if bx < self.xmin then | ||||
|   self.color = 9 | ||||
|   want = s.thrust | ||||
|   txm = self.xmin | ||||
|   v1 = calc_velocity(s.dx, want, s.maxspd, s.drag) | ||||
|   bd, bf = brake_dist(v1, bmx) | ||||
|   bx  = bd + s.x | ||||
|   bx  = bd + s.x + v1 | ||||
|  end | ||||
|  if (bx < txm) return want | ||||
|  self.color = 8 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user