mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
fix spawning of vehicles on borders
This commit is contained in:
parent
e330061b91
commit
f9ccecad26
@ -4,13 +4,11 @@
|
||||
|
||||
- cache draw agents
|
||||
- actually use Drawables in the places
|
||||
- have to undo the hacks for cars appearing out of a border
|
||||
|
||||
## Quick n easy
|
||||
|
||||
- try showing traffic signals by little boxes at the end of lanes
|
||||
- red circle means right turn on red OK, red right arrow means nope, green means normal turns ok, green arrow means protected left, crosswalk hand or stick figure
|
||||
- Circle::new radius and pt project_away should take meters type
|
||||
|
||||
- if a lane could feasibly have multiple turn options but doesnt, print "ONLY"
|
||||
- color roads as solid black when zoomed out, and make intersections similar (except for stop sign / signal)
|
||||
|
@ -90,7 +90,6 @@ impl Pt2D {
|
||||
}
|
||||
|
||||
// TODO better name
|
||||
// TODO Meters for dist?
|
||||
pub fn project_away(self, dist: Distance, theta: Angle) -> Pt2D {
|
||||
// If negative, caller should use theta.opposite()
|
||||
assert!(dist >= Distance::ZERO);
|
||||
|
@ -10,7 +10,6 @@ use crate::{
|
||||
AgentID, CarID, Event, ParkedCar, ParkingSpot, PedestrianID, Tick, TripID, VehicleType,
|
||||
};
|
||||
use abstutil::{fork_rng, WeightedUsizeChoice};
|
||||
use geom::Distance;
|
||||
use map_model::{
|
||||
BuildingID, BusRoute, BusRouteID, BusStopID, LaneID, LaneType, Map, Path, PathRequest,
|
||||
Pathfinder, Position, RoadID,
|
||||
@ -114,7 +113,7 @@ impl Command {
|
||||
DrivingGoal::Border(_, l) => *l,
|
||||
};
|
||||
PathRequest {
|
||||
start: Position::new(*start, Distance::ZERO),
|
||||
start: Position::new(*start, vehicle.length),
|
||||
end: Position::new(goal_lane, map.get_l(goal_lane).length()),
|
||||
can_use_bus_lanes: vehicle.vehicle_type == VehicleType::Bus,
|
||||
can_use_bike_lanes: vehicle.vehicle_type == VehicleType::Bike,
|
||||
@ -222,7 +221,7 @@ impl Spawner {
|
||||
owner: None,
|
||||
maybe_parked_car: None,
|
||||
vehicle: vehicle.clone(),
|
||||
start: Position::new(start, Distance::ZERO),
|
||||
start: Position::new(start, vehicle.length),
|
||||
router: match goal {
|
||||
DrivingGoal::ParkNear(b) => {
|
||||
if vehicle.vehicle_type == VehicleType::Bike {
|
||||
@ -461,11 +460,13 @@ impl Spawner {
|
||||
if let DrivingGoal::ParkNear(b) = goal {
|
||||
legs.push(TripLeg::Walk(SidewalkSpot::building(b, map)));
|
||||
}
|
||||
let vehicle = Vehicle::generate_car(car_id, base_rng);
|
||||
assert!(map.get_l(first_lane).length() > vehicle.length);
|
||||
self.enqueue_command(Command::DriveFromBorder {
|
||||
at,
|
||||
trip: trips.new_trip(at, Some(ped_id), legs),
|
||||
car: car_id,
|
||||
vehicle: Vehicle::generate_car(car_id, base_rng),
|
||||
vehicle,
|
||||
start: first_lane,
|
||||
goal,
|
||||
});
|
||||
@ -599,6 +600,7 @@ impl Spawner {
|
||||
if let DrivingGoal::ParkNear(b) = goal {
|
||||
legs.push(TripLeg::Walk(SidewalkSpot::building(b, map)));
|
||||
}
|
||||
assert!(map.get_l(first_lane).length() > vehicle.length);
|
||||
self.enqueue_command(Command::DriveFromBorder {
|
||||
at,
|
||||
trip: trips.new_trip(at, Some(ped_id), legs),
|
||||
|
Loading…
Reference in New Issue
Block a user