I have the following algorithm that spawns the Sports Car device (following the guide on dynamically spawning devices).
This works but has it’s issues. For instance, I have set the device to not be visible in game, however, it insteads shows a holographic mesh representing the base of the device, which somehow prevents the player from entering the vehicle. I tried clearing the mesh of the spawn pad but this was not possible apparently:
I also can’t figure out a way to get a reference to the spawned device. I tried casting the spawned prop to the sports car device, however, this did not work:
if(VehicleDevice := vehicle_spawner_sports_car_device[SpawnedProp]) {}
I can get a reference to the vehicle device using a for-loop with the method FindCreativeObjectsWithTag(vehicle_spawner_tag{}) (like in the guide), but this is unconvinient since I am going through every vehicle that the player would spawn, when really I only need the one that player just spawned. Here is the code I made:
OnSpawnVehicleTriggerPressed<private>(Agent:agent):void=
if(FortCharacter:=Agent.GetFortCharacter[]):
PlayerTranslation:=FortCharacter.GetTransform().Translation
PlayerRotation:=FortCharacter.GetTransform().Rotation
if(Prop:=SpawnProp(Vehicle_Spawner_Sports_Car_Prop, PlayerTranslation, PlayerRotation)(0)?, CreativeObject:=creative_object[Prop]):
for (Obj : FindCreativeObjectsWithTag(vehicle_spawner_tag{})):
if (VehicleSpawner := vehicle_spawner_sports_car_device[Obj]):
VehicleSpawner.Enable()
I would really appriciate it if someone could give me a hand on this issue. Thanks in advanced.