Add vertical offset to avoid collision when spawning
This commit is contained in:
parent
7f51f21ee5
commit
2c7fcd5491
|
@ -327,6 +327,7 @@ def main():
|
||||||
ped_bp = random.choice(world.get_blueprint_library().filter("walker.pedestrian.*"))
|
ped_bp = random.choice(world.get_blueprint_library().filter("walker.pedestrian.*"))
|
||||||
trans = carla.Transform()
|
trans = carla.Transform()
|
||||||
trans.location = world.get_random_location_from_navigation()
|
trans.location = world.get_random_location_from_navigation()
|
||||||
|
trans.location.z += 1 # Apply an offset in vertical axis to avoid collision spawning
|
||||||
ped = world.spawn_actor(ped_bp, trans)
|
ped = world.spawn_actor(ped_bp, trans)
|
||||||
walker_controller_bp = world.get_blueprint_library().find('controller.ai.walker')
|
walker_controller_bp = world.get_blueprint_library().find('controller.ai.walker')
|
||||||
controller = world.spawn_actor(walker_controller_bp, carla.Transform(), ped)
|
controller = world.spawn_actor(walker_controller_bp, carla.Transform(), ped)
|
||||||
|
|
Loading…
Reference in New Issue