I’m new to UE4. There is a problem I’ve been thinking for a long time. I checked many tutorials but I can’t find a better solution. I think I might get some help here.
This thread might looks long, but most of them are just pictures to explain the problem.
Thanks for your time, and I apology for my poor English in advance 0_0
I’m trying to make a traffic system, which includes：
----Auto generate different Roads[done]
----For each type of Road, there should be corresponding RoadPoints[Problem here]
----Randomly generate Vehicle, and the Vehicle will automatically find the closest RoadPoints [done]
----After Reaching each **RoadPoints, **Vehicle will go after the [NextPoints] or [NextAlterPoints] or [NextStopPoints], As the ,[green], line showed in the picture below [done]
Problem here is I can’t find a way to set RoadPoints in Road effectively
Still in the picture below, I selected my RoadPoints Actor. It’s a BP Actor that generate an arrow to every RoadPoints in the [NextPoints] list.
It’s done in the Construction Script, so I can easily pick up a RoadPoints or modify its position. And I can see the result after each action.
So far, it’s fine and convenient to connect** RoadPoints** in a scene (permanent level)
Then I made several types of Road Actor for random spawning, and I try to attach the RoadPoints to the Road as ChildActor. Showed as picture below
Then the problem here is, for each RoadPoints child actor, I can’t select RoadPoints child actor as [NextPoints]. Not like what I can do when I put the RoadPoints into a scene (permanent level)
So to connect these RoadPoints child actor, I set the [NextPoints] in the Construction Script in each Road Actor.
As the picture showed below, it is very complicated(4x picture for one Road Actor)
After the settings above, and the condition that I need to compile RoadPoints after compile Road, I can get the result that is a Road with RoadPoints connections preview able.
I can barely achieve the system now, but I think it is too low efficiency, and hard to make changes
The whole big question for me is IF/HOW I can do better to attach the RoadPoints to the Road and connect them easily.
I think it’s a same question about how to attach a child actor to another actor and set connection among them
Of course I’m not asking for a full solution. If you have any experience or thoughts on this, please, just let me know
It’s OK for me to throw everything away and redo from beginning.
For this traffic system, I need many Road types like 2-lane Road, 4-lane Road, 6-lane Road, cross Road, Arc Road, or some roads with strange shape, so I think a flexible RoadPoints with preview is a must have.
I tried to use BP actor component instead of BP child actor. It can save the process of cast to, but BP actor component do not have a Construction Script and make the preview more complicated. I still do not know how to find all my BP actor component under one actor and do something to them.
I also tried to put a ArrowComponent or a box to replace the RoadPoints actor, but I can’t find a place to set data structure like [NextPoints] [NextAlterPoints] [NextStopPoints], seems to be worse than a BP actor component
Or, is it possible to select several Actor from the scene and make it an new Actor? Like what you can do to create a prefab in Unity. If so, I don’t have to attach them, I just need to spawn two actors together.
Anyway, thank you for your reading!! Any thoughts please let me know.