How to Spawn Scene Capture at Runtime
I am trying to create a simulation where the user can drive a car around a map. The car will be equipped with various sensors (example: camera, radar, lidar, ...). I have been able to create the sensor by placing using a 2D scene capture. This works great and all but I want to create some way of defining the number and position of the scene captures through a configuration file of some sort. I am not sure how to go about creating such a file or what code I would need to process the file and place the scene captures on the vehicle blue print at run time.
I've gotten everything to work thanks to the discussion bellow, however I get an error when trying to spawn the SceneCapture during runtime. The code is
which ends up returning a nullptr and printing error
Not sure what to do about it.
Also, I updated the sensor config to
and tried using a config called DefaultSensorPlacementConfigData.ini
When looking in at the blueprint in ue4 I see the default value for the array of sensors and added a sensor
But when printing the values in c++ they are all 0. Not sure why that is or how to get my values showing up.
To recap please help with SceneCapture spawn problem and config values not being set properly.
Tried using a struct instead of class for config object. Here is my final attempt, I fiddled a bunch with it and couldn't get it to build
The error produced at the "sensors" line is
When you have multiple issue you should create multiple tickets. The noise on this page is a good reason why..
A couple notes about config serialization.
the are customarily used to indicate a user dependent value. they should not appear in the final ini.
Unreal strips the 'U' for components and UObjects and strips the 'A' from actors.
SO if your project is called Watsom. Then you have a Watsom.build.cs file. And c++ classes in that Project are refered to in the ini as [Script/Watsom.]
then you can access the members of the CDO for USensorPlacementConfigData in the ini by name. Seperate items with a comma, and use () to go down into a member definition.
so your ini should read:
note the '/' at the end of line 1 this tells unreal that the assignment will continue on the next line.
You can add a line +sensors=... for each sensor you want to add to the array.
Alternatively you can populate the entire array at once with :
With each wrapped in () and separated by a comma.
answered Mar 08 '18 at 02:44 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here