So I have added a line trace to my ball so that I can trigger an “IsGrounded?” boolean variable, it works but the problem is that when the ball is rolling on the ground the console prints “Is Grounded”, “Is Not Grounded”, “Is Grounded”, “Is Not Grounded”,“Is Grounded”, “Is Not Grounded”… etc. If the line trace I have is going through the actor (the floor) constantly why is the boolean being changed to false?
for something like this it might be better to use a oncomponentBeginoverlap. Put the sweep result into your break hit result and get rid of the line trace. maybe even the hit result node all together.
If its alternating, it may be because the direction of the trace is changing as the ball moves?
if you want to use the trace… set the debug to duration and see where each trace is hitting. if they start going off in the air… thats why. Find a way to point them at the aground within a foot of it… or use an overlap instead.
I had originally had that problem with the line trace, its origin was for whatever reason outside the ball and I had no way of moving it manually so what I did was make a socket at the ball’s center (it was 100 units radius so I placed it at 50) I then made the line traces origins start at the socket and made it shoot negative on the z axis. That resolved that first issue. The line trace no longer rotates with the ball, it is always shooting directly downward.
Im a bit confused at what I should try here, using a collision overlap would I not need to add a collision sphere to my ball actor? Initially I had used that but the problem is that I dont want the ball to be able to trigger “grounded” when it overlaps walls/ ceilings/players/other balls/ ect… easy enough to ignore those things but at the same time isnt a line trace more efficient? The reason I went with this method was because it was what I had used in unity on a 2.5d side scroller game. On the player actor I had shot a raycast(line trace) straight down from the players position, if the trace hit the floor it would know it was grounded and the player could jump again, otherwise it was not grounded so the jump action would be disabled. I feel like i am just missing something simple to have this work perfectly. I will try the collision method again though and see if i cant get it working that way.
The only thing I can think of why the line trace is coming back not hitting something and you’re sure they always shoot downwards is if the line trace is going THROUGH the ground mesh and hitting air.
As a quick test, try this. instead of using the blocking hit from the result, clear that and leave blocking hit blank. Drag out from Return Value from the line trace and connect that to your branch instead. See if that works as is… then if not you can also try replace the line trace with a by channel instead of object. Or even a sphere trace, since it’s wider you can ensure it’s hitting the ground.
Also it doesn’t look like your CAST is doing anything in this scenario yet.
Alright so I was able to get something finally working, but not to your suggestion. I messed around with using material hits instead of an actor. For whatever reason the floor object I had was causing weird returns on the line trace. Here is a screen shot of what I have now that has been working consistently with no issues.