Hi UDN,
I would like to know if there are any plans to support the PhysicalMover with nav mesh based pathfinding.
I have been working a bit with the new Mover and it is very interesting but I have not been able to make the PhysicalMover work with pathfinding (to handle, for example AI).
While it all works fine if I use the kinematic Mover.
Analyzing the code I noticed that the thing is that in the UMoverNetworkPhysicsLiaisonComponentBase if the NetworkPhysiscComponent is not locally contolled a different flow is executed and the ProduceInput is not called.
I also saw that there is a UPathedPhysicsMoverComponent and a UPathedPhysicsMovementMode but they seem to serve to follow a pattern and not a path generated by the navmesh.
Am I missing something?
Thank you very much.
Hey Matteo,
Pathfinding should work with the Physics Mover! We just might need some extra set up that the physics examples don’t do. Does your pawn have a NavMover component like the Kinematic examples in the MoverExamples plugin? This component is required as it is in charge of communicating with the PathFollowing component and passing input into the Mover simulation.
Thanks,
Nate
Yes, my Pawn is ready to work. In fact the same identical Pawn works with a non physics mover. The problem is that when I use a physics Mover the ProduceInput is not called. This is in the UMoverNetworkPhysicsLiaisonComponentBase.
As far as I understood debugging the code this is what prevents the ProduceInput to be called: (row 545 UMoverNetworkPhysicsLiaisonComponentBase::ProduceInput_External)
if (!NetworkPhysicsComponent || NetworkPhysicsComponent->IsLocallyControlled())
{
PerformProduceInput_External(DeltaSeconds, Input);
// This is the net instance responsible for actually producing the input command, so set LatestInputCmd here to be picked up by the NPC for replication
// All other net instances will have LatestInputCmd assigned in PreProcessInput by the NPC and applied as the actual InputCmd to process down in ProcessInputs_Internal
LatestInputCmd = Input.InputCmd;
}
Thank you.
Hi,
now the AI works with the physics mover but I have one more problem. As soon as I touch the enemy while it’s movng with my player character (that it’s still driven by a physics mover, so everything should be physical) the enemy is launched away with an incredible velocity. I tried to debug it and I’ve seen that the
StartingSyncState->GetVelocity_WorldSpace()
becomes crazy high.
The same thing happens if the enemy collides with physics bodie whil it’s moving. I tried to put physics cubes all aroun the enemy and sometimes when it touches them it is launched away.
Thank you
I’ve clicked the bug report but it leads me to an empty page. (https://issues.unrealengine.com/issue/UE-314577)
Hey Matteo,
It seems we handle this case for networked play but don’t account for non-player controlled local movement in standalone play. Thanks for bringing this to our attention! You’re not missing anything, it looks like this is due to UNetworkPhysicsComponent::IsLocallyControlled only checking for a player controller rather than controllers in general so making that function use a AController should fix the issue. I’ve already submitted a fix for this so it should be reflected to UE5 Main on Github soon and should be included in the release of UE 5.7
Thanks,
Nate
Interesting. I’m seeing this happen every once and while on my side as well. I went ahead and logged a bug (Unreal Engine Issues and Bug Tracker (UE\-314577\)) for this on our side and you should be able to see it soon once it goes live. I’ll try to update this thread if I find a workaround. Thanks for bringing this to our attention!
Thank you very much, let me know if you find a solution.