4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.82k stars 848 forks source link

Stop object does not stop movement of Pathfinding movements #1135

Closed shinobirozs closed 3 years ago

shinobirozs commented 5 years ago

Describe the bug

There seems to be no way to stop a moving object with the Pathfinding behaviour.

To Reproduce

Steps to reproduce the behaviour:

  1. Add a Pathfinding behaviour to an object
  2. Move the object to the mouse position
  3. Use Stop object action to stop the moving object
  4. The object doesn't stop moving.

Other details

Thank you.

4ian commented 5 years ago

As a work around, you can try calling the action to go to a position and set the position to the X and Y position of the object.

Wend1go commented 5 years ago

I think the ideal behaviour would be to stop the moving object in place when the "Pathfinding Behavior" is disabled and continue moving when it is enabled again. After a quick glance on https://github.com/4ian/GDevelop/blob/master/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js I don't even see an onDeactivated function. :confused:

4ian commented 5 years ago

When a behavior is disabled, doStepPreEvents won't be called so, while I've not tested this recently, this should still work (i.e: disabling the behavior should disable the movement). Movement will still resume as soon as you enable again the behavior.

shinobirozs commented 5 years ago

Thank you. I'll try using the workaround first. It would be great if we can use Stop object action in the future since it was the first action that comes to mind if we want to stop object movements.

Cheers!

4ian commented 5 years ago

Add this on the roadmap: https://trello.com/c/ABOAzUjj/326-add-action-for-stopping-objects-using-the-pathfinding-behavior

shinobirozs commented 5 years ago

Hi,

I tried the work around by moving the character to the character's current position but it teleports it back to the original position as seen below. The workaround seems to not solve the issue. Thanks.

ezgif com-optimize

image

shinobirozs commented 5 years ago

I tried to disable the Pathfinding behavior and it did stop the characters movement. I'll use this as a workaround for now. Thanks for your time.

image

4ian commented 5 years ago

Great that it's working with this - nice graphics by the way!

but it teleports it back to the original position as seen below

Indeed, that's a nasty bug! I fixed this for next version :) Can confirm that setting the destination to the object X;Y position will properly stop the object.