godot icon indicating copy to clipboard operation
godot copied to clipboard

Add optional param `cancel_sliding` to `move_and_collide`

Open adamscott opened this issue 1 year ago • 5 comments

This PR exposes the p_cancel_sliding as a parameter to move_and_collide in ClassDB (which GDScript uses). This makes it possible to specify either to cancel sliding or not.

As @smix8 said in the proposal:

The problem here is more the method binding, e.g. GDScript users think they are calling move_and_collide() but what they are really calling is a _move() wrapper function that omits parameters.

~~Open questions~~

~~Currently, there's a discrepancy between 2D and 3D in the cancel_sliding default values. The original C++ move_and_collide p_cancel_sliding parameters change between versions (being true on 2D, and false on 3D).~~

~~I chose to keep that default behavior for the exposed ClassDB move_and_collide, but maybe it should be better to expose the same default for end-users.~~

(update: it was me that caused that discrepancy but didn't realized it. Thank you @AThousandShips!)

MRP

cancel-sliding.zip

Fixes

Fixes godotengine/godot-proposals#9253

adamscott avatar Mar 08 '24 16:03 adamscott

Thank you a lot for working on this!

yosoyfreeman avatar Mar 08 '24 17:03 yosoyfreeman

It seems like merging is blocked due to failed checks for the linux editor.

yosoyfreeman avatar Mar 13 '24 14:03 yosoyfreeman

Indeed. It's because the extra argument makes this a breaking change (at least for GDExtension). It would need a compatibility method (wouldn't know how to do it right now).

Mickeon avatar Mar 14 '24 19:03 Mickeon

I'm on it. This PR slipped between my cracks, sorry!

adamscott avatar May 25 '24 13:05 adamscott

Can this make the cut for 4.3 still? Unsure, but worth noting.

Mickeon avatar Jul 06 '24 21:07 Mickeon