Download

LineTrace output delayed randomly from the start of the game

Hello,

I am having a problem with LineTrace having a seemingly random delay from the start of the game before it actually starts to output a correct hit value. I want to use LineTrace to adhere my vehicle to the ground under it and simulate basic gravity, by driving AddActorWorldOffset Z value by the distance parameter of the line trace.

The huge problem I am having is that for a first few seconds, LineTrace outputs 0, before I move my pawn and turn it. It appears to be completely random, but I need to do some amount of movement and some rotation to the actore before LineTrace starts working correctly. Here you can see it on the video:
https://youtube.com/watch?v=KmPLYpH07Ng

Now, I am actually subtracting a value representing distance from the actors pivot to its base from the hit distance value, to ensure that the actor is standing on its base. Therefore, before LineTrace actually starts returning correct value after a few seconds, the initial value is stuck at the subtracted value, not at 0, and since I am feeding this into AddActorWorldOffset, obviously, my vehicle is launched into the oblivion.

How can I ensure that the LineTrace will start returning the correct value from the very first frame of the game?

Thank you.

EDIT: Here is the video of practical implications this problem has. Basically, if I run the game, my tank will launch far away as the line trace returns nonsense. If I manage to quickly hit a key to move my vehicle before line trace runs out of its length, it actually activates and everything starts working. But I just can not understand why in the world does line trace need some actor movement to start working, when all it’s hooked up to is event tick.
https://youtube.com/watch?v=NH2Qki0wgW0

Anyone? It’s driving me crazy :frowning:

can you print the bool “return value” on the line trace, maybe the trace is under the ground when you start the game? and also set a “draw debug type”