SnpM / LockstepFramework

Framework for lockstep RTS, TD, and MOBA games.
MIT License
1.4k stars 348 forks source link

unit chasing issue #80

Closed maxin0628 closed 8 years ago

maxin0628 commented 8 years ago

Hi, I'm testing the demo's pathfinding for my project, everything is fine, but when a unit is chasing another, if I change one's path(select it and hit somewhere else) , the chasing one is still following the old path, until get to the last point where the changed one was, then turn to the changed one.

the behavior I expect is if the one being chased turn to other direction, the chasing one immediately update the chasing direction, could you please point out a way to achieve this?

maxin0628 commented 8 years ago

I have checked the code of this part, I found LSBody.PositionChanged is always updated after the PositionChanged checking in Scan.cs line 277, because it's updated in PhysicsManager's simulate, I notice it's after the AgentController's simulate,(LockstepManager.cs line 215).

so the question is: is that ok to move PhysicsManager.Simulate(); before AgentController.Simulate();? and it seems more reasonable.

thanks

SnpM commented 8 years ago

Thanks for finding the bug. LSBody.PositionChanged behaves as you explained now, but I didn't update that instance of it yet. It's now fixed.