Hey everyone!
I’m currently trying to find a way of connecting 2 (or more) 3D Widgets with one another through a line that only can make 90° turns.
I have an Array of “TargetWidgets” which goes into a for each loop.
But now I need to figure out how and where to actually add the spline meshes to.
This is what I got so far:
So I want those lines to “avoid” other widgets and if possible not to cross other lines.
In Short I wanna do a Level - That is a Level Selection on it’s own. So I lie down these 3D Widgets and add them to the Array of Targets. And if the Player finishes level 1 for example they unlock the next bunch of levels.
In the end they are free to choose which “path” the want to take.
You can almost think of it like the level selection in super mario world.
So yea these are 3D UMG Widgets without any mention worthy logic… only a button and some text.
The Array is of type “A_MenuWidget” which is the actor class that contains the 3D widget Component aswell as the “connection” logic.
I’m currently trying to figure out when to rotate it and where to rotate it to.
Also I don’t have a spline at all :o Probably didn’t see a reason to use it ?
However the most problems I have with translating the Target Actor location to the relative location for the origin actor.
I just don’t quite understand it.
It is not very clear what you want to achieve here, perhaps some pictures would help. Is your TargetWidget of type ‘UserWidget’? Are we talking about UMG here? Or are you referring to something else?
In your spline node, you set the location offset, why not set a rotation offset as well? Incrementing by 90 degrees at a time or something? (or some other logic could determine if it’s +/- 90 each time, or whatever else you need). Also, at each addition of a spline point, you could take that location, and do a linetrace towards the next direction and figure out if you’re colliding with something or not etc. You may have to have a nested for loop, if you want to check for left/forward/right direction in your targeting for the next spline location. I am not 100% certain what you want to achieve though, so have no idea if I’m proposing something useful here.
I’ve tried a few things by now:
Trying to calculate the path from one actor to another.
Trying to use normal splines with spline meshes.
None of which really worked out.
I’m trying to make it simple but I also don’t want to have billions of plane meshes just for a single connection.
I might try around a bit more to see how far I can get with it.
I see. I think you are probably overcomplicating this. Why not just build this manually? With more UMGs that show the connecting lines. Why write complicated logic for this? Or, I would actually probably represent the level squares/buttons with a simple Actor type that has a 3D UMG attached with the level name or other icon. I would have invisible meshes in the shape of connecting lines. When a level is finished, a simple function / event in the actor says 'SetVisibility to connecting line meshes to true. You can predefine with simpler logic in those Actors which levels each one unlocks. Linetracing and collisions… you are trying to do 3D gameplay logic for a menu!
But for what it’s worth, if you really like that concept, then having the levels be represented by actor types, could help you with your collision logic.