So basically for a week I’ve been trying to get this simple thing to work, only for the engine to vex me at every turn.
First I wanted to mark the tile number and then I could get a WillCollide event and then reject it if the tile number was in a range of drop through and the collision point was anything other than below me. This is the logical and best solution, however from what I can tell this is not possible in the engine, you get notified of a collision but you can’t then reject it and choose to ignore it, as it has already happened.
So I then set about making channels, you can’t change the channel of a box on a tile map, so I split my tile map into 2 tile maps, one for solid and one for the new “dropdown” channel. From here it was a simple case if I’m going up then I make the player actor not be blocked by “dropdown” so I will pass through it, and otherwise I am, thus I will land upon them. This mostly works however it has a flaw. Namley if you are walking into a “dropdown” platform from the side you will be stopped by it, you have to be able to walk thorugh it. You can’t just make it so you don’t collide against a “dropdown” when you are on the ground as you might be standing on one, and hence need to remain “blocked” by one. To solve this I would cast a Trace down under the player. If I did it for “dropdown” it would find nothing, even when I was atop of one. If I did it for Static it would generate a hit object, but only if I was moving. If you stand still no hit. Odd but I could just cache the last value. This then lead to how do I know that I have a “dropdown” since I can’t just take a hit against that channel as a yes/no. I have to filter it out.
After faffing about I came across Landed which gives me the info I mostly need, and a Hit without having a randomly failing Trace.
But the issue of what am I standing on still stands.
I then figured I could set the two maps as params on my actor in the editor, although this might not work because for some reason ( seems to be something with UE 5.02? ) the objects are lost, so I have to open, compile, reload the level for it to get my actor class. This means a few params that are set get lost each time, and I have to set them each time again. This has led me to set everything in C++ as the editor values get lost, a lot. But still setting two maps in the editor not so bad.
So I exposed them like so
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
class APaperTileMapActor* MainTileMap;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
class APaperTileMapActor* DropThroughTileMap;
and while they appear in the editor
they are greyed out and can not be selected, dragged to or changed in anyway. A search found the same issue with 4.1X and the solution was right click on actor and select reload. This option doesn’t appear to be valid in 5 anymore. I have re compiled and reopened the level etc all to no avail. Oh well it probably was going to get lost anyway… so lets do it in code. I know I can use the name, i.e if the name has Drop in it, its the drop one.
Nope, the name is not what you see in the editor but is something along the lines of “Paper2D_TileMap_1” which is useless.
There is a get GetActorLabel but that is Editor only, so useless for this application.
So get each one, then look up the collision then look up the channel and see if its “dropdown” this just seems really convoluted and “not the way to do a really simple thing every game of this type will need to do”. Does explain why no tutorial has ever covered it though
Also you run into the issue where if you are standing on a “Dropdown” and walk into another “Dropdown” you still want to walk through the other one. Thus I need to make 3 maps, 1 for normal, 1 for even dropdown and 1 for odd dropdown so you never walk into a dropdown while on a dropdown because one is dropdown1 and the other is dropdown2.
What is the proper way to solve this problem?
What is the proper way to find and link a specific per level item to the player actor?