Top Down Character Movement - Hit Result Under Cursor by Channel - Problem

Hello everyone!

I am currently trying to improve the movement system that is used in the Top Down Package for UE4. What i want to achieve is that blocking objects (like walls and monsters) are ignored by the mouse when i click it for the character to move. As it is now it feels very clunky. After consulting google search i found that the solution to this would be to setup a new custom trace channel (which i called movement) and set it to “Ignore”. Then i made a Floot Object Blueprint with custom collision settings where i set the “Movement” Trace Channel to “Block”.
The “Get Hit Result Under Cursor by Channel” function is set to use the “Movement” Trace Channel. To my understanding the cursor should now only be blocked by my floor class objects and not by wall and other stuff? For some reason it is not working as i think it should. Does anyone have any clues for me?

Thanks in advance!

Allright, i found the soltion and its pretty embarrassing :wink:

The Character Movement is done in the Player Controller not in the PlayerCharacter. The Screen i posted is only for the MousePointer Decal, which does nothing for the Character Movement…

Enclosed a Screenshot of the Solution.

It’s works a lot smoother if you move the trace outside of the function and add a branch between it and the function. Pass the hit result to the function only if it’s a valid hit; you can just use the boolean off the trace as the check. I had a similar problem where my character kept moving back to the center of the world if the cursor hit anything not on the movement channel. Fixed with the added branch.