Download

RequestDirectMove MoveVelocity is -inf after OpenLevel

Hello Everyone,

I have a bit on an issue with the RequestDirectMovemethod of UNavMovementComponent. Basically, I have a custom MovementComponent that overrides RequestDirectMove. I call MoveToActorin a custom AAIControllerto move the AI to the player’s Pawn. Unreal calls RequestDirectMove somewhere in the chain and provides me with the MoveVelocity. Then, I do some math to make the AI physically move.

When I directly play the level, no problem. The AI is able to move towards the player and go around obstacles. But, if I start from the main menu, press Play, which calls OpenLevelto open the level, then the MoveVelocity passed in RequestDirectMove is randomly set to (X=-inf Y=-inf Z=-inf) and stays at this value forever, which breaks my math, obviously.

Like I said, it only happens when I start the game from the main menu. I’m doing nothing fancy in the menu other than calling OpenLevel when the Play button is pressed and QuitGame when the Quit button is pressed.

I’ve checked if the player’s Pawn is set before calling MoveToActor - it is. I’ve checked if my NavMesh is correctly loaded after OpenLevel is called and the level is loaded - it is.

Thank you !