Hi Guys,
I have a doubt, kindly help me in finding the correct solution. Given below is the problem statement.
Lets say I have spawned around 80 vehicles in the environment. And after that I have started the manual_control.py script to start the player vehicle.
Now if I run actors = world.get_actors().filter('vehicle.*') it is going to return all the actors along with the player vehicle. Now I want to fetch only player vehicle and monitors its position, velocity, add sensors etc.
If I am writing a python script, how would I unique identify the player vehicle out of all actors ?
For example I want to uniquely distinguish the player vehicle dynamically.
Thank you,
KK
We recently added the "role_name" attribute to actors, the player in manual control has its role set to "hero" automatically
for actor in world.get_actors():
if actor.attributes.get('role_name') == 'hero':
player = actor
break
@nsubiron that's awesome. Thanks for letting me know. That information would be very helpful in my future works. Will try it out and update you soon.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
We recently added the "role_name" attribute to actors, the player in manual control has its role set to "hero" automatically