Currently, I’m using the top down game template and I find it odd that I can’t move the player character behind objects. I suspect it may be the result of “get hit result under cursor by channel” getting the hit result from whatever object is blocking the ground plane. Is there any particular alternative I can use that lets me move an object behind other objects during gameplay? For the reocrd, the style I’m talking about is similar to most top-down isometric RPGs where you can move behind walls and such.
Just set up the collision of the objects and the ground plane so that only the ground plane blocks the trace channel you are using. Make sure that the channel you are using for Get Hit Result is set to “block” on the ground plane and “ignore” on other obstacles. You can create your own, custom trace channels in the project settings if you want more control.
I tried doing this but i can’t seem to get it to work. I created a new trace channel, Landscape, and set it default to ignore all. Then, on my ingame landscape, i set the collision to custom, and have it block the Landscape trace. In my code, I have:
bool hit = this->GetHitResultUnderCursorByChannel(UEngineTypes::ConvertToTraceType(ECC_EngineTraceChannel1), false, result);
My in game characters and buildings are still resulting in a hit, instead of my trace going through and hitting the landscape. Any ideas?
It’s not actually the mouse trace, it’s the NavMesh. If a path couldn’t be found, the character won’t move, and I think this is due to using “Simple Move To” for moving the player pawn (sorry, don’t have access to the editor to double check). I started trying to work around this when I ran into it last week, but never finished it. Basically, finding the nearest point on the navmesh to the point that was clicked on, and I think I found a node that would do that but totally can’t remember it.
In my case, i’m not using the nav mesh. I’m using the hit result to place buildings. If i mouse over a unit or a building, my hit result gets blocked by the buildings/units instead of going through to the landscape.
Makotech, in your case, when you want to place buildings (perhaps a mode type in your game?) you just need to use a trace channel that your buildings overlap/ignore and your terrain blocks, then if you get to select buildings later, you can trace to a channel that is blocked by the buildings. Check out Collision in Unreal Engine | Unreal Engine 5.1 Documentation for more info on how collisions/traces interact.