Carla: where is implemention of the function SpawnVehicle() in VehicleSpawnerBase.h?

Created on 5 Feb 2018  路  7Comments  路  Source: carla-simulator/carla

Hello,
I'm currently reading your awesome code but I find something very confusing that in VehicleSpawnerBase.h, there's a SpawnVehicle() which I can't find the implemention.
Where's it?
Thank you.

question

Most helpful comment

Hi @barontxu, good catch ;) the function is implemented in the derived _"VehicleSpawner"_ Blueprint; note that it is marked as UFUNCTION(BlueprintImplementableEvent). When you call this function you are triggering a blueprint event.

The C++ code decides when and where the vehicle is spawned, but the Blueprint decides the model and color of the vehicle. This way the C++ code doesn't need to know about the assets.

All 7 comments

Hi @barontxu, good catch ;) the function is implemented in the derived _"VehicleSpawner"_ Blueprint; note that it is marked as UFUNCTION(BlueprintImplementableEvent). When you call this function you are triggering a blueprint event.

The C++ code decides when and where the vehicle is spawned, but the Blueprint decides the model and color of the vehicle. This way the C++ code doesn't need to know about the assets.

@nsubiron Yes i see. Do we have to spawn actor in blueprint? I tried c++, but the car i spawned just can't move.

@nsubiron And thanks much to your swiftly respond. You're so nice.

It should work in C++ too. Just make sure the vehicle is a subclass of ACarlaWheeledVehicle and follow all the steps in AVehicleSpawnerBase::SpawnVehicleAtSpawnPoint() function (you need to spawn the controller and give it a road map).

@nsubiron you mean, for example, I can do it with
GetWorld()->SpawnActor ?

Yes, that should work

Thank you. I'll give it a try.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gkahn13 picture gkahn13  路  24Comments

najibghadri picture najibghadri  路  23Comments

akramer123 picture akramer123  路  25Comments

yangyueren picture yangyueren  路  22Comments

nsubiron picture nsubiron  路  25Comments