GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Sharp turns with topdown

Open PascalLadalle opened this issue 2 years ago • 11 comments

When top-down behavior is used with low values for accel-/decel-eration, to reproduce movement on a sliding surface (ice), the top-down produces sharp turns at high speed that it doesn't do at low speed. Dummy project included below. Press arrows and change direction at low speed and full speed to see the sharp turns. Sometimes, the sharp turn is immediate, sometimes it comes with a little delay.

Icesliding.zip

PascalLadalle avatar Apr 05 '22 18:04 PascalLadalle

@PascalLadalle could you try 5.0.131 ?

Game engine improvements

Top-down movement extension improvements: Add a condition to check which key was used or simulated and actions to change the current velocity Fix the velocity value that wasn't exactly 0 when moving horizontally or vertically

Bouh avatar Apr 07 '22 13:04 Bouh

@PascalLadalle could you try 5.0.131 ?

I don't notice any difference with v131.

PascalLadalle avatar Apr 07 '22 20:04 PascalLadalle

I assign our math master @D8H here to highlight what could be a solution.

Bouh avatar Apr 08 '22 09:04 Bouh

When the max speed is reached the velocity directly follows the inputted direction.

The 2 following demos show what happens if the behavior stay coherent.

Always direction inertia:

  • https://liluo.io/instant-builds/2c11bf75-3f76-4a1a-a30d-3078faf556af?dev=true

Never direction inertia:

  • https://liluo.io/instant-builds/197eeb7f-12dd-40fe-9a4d-472606b87899?dev=true

The second one is probably near to what you are asking and it seems usable so may be it could be chosen by property.

D8H avatar Apr 08 '22 10:04 D8H

The second one is the current behavior, the first one is what the forum user was requesting. I guess both ways could be useful, so a property would be great, indeed.

PascalLadalle avatar Apr 08 '22 12:04 PascalLadalle

The current behavior is:

  • max speed is not reached: 1st case
  • max speed is reach: 2nd case

Which topic is it?

D8H avatar Apr 08 '22 12:04 D8H

Yes, that's right. Here's the topic: https://forum.gdevelop.io/t/how-do-i-make-player-slip-on-ice-in-topdown-game/39017

PascalLadalle avatar Apr 08 '22 17:04 PascalLadalle

@D8H Hi! Do you have a workaround I can forward until a fix is implemented?

PascalLadalle avatar May 30 '22 08:05 PascalLadalle

The case is too specific to be integrated in the top-down behavior as it would be almost impossible to control.

It can be done using variables for acceleration and force actions to set the speed or Physics2.

D8H avatar May 30 '22 09:05 D8H

The current behavior produces inconsistent results depending on the object's speed. That needs to be fixed somehow, no? 🤔 If it doesn't do sharp turns at (max speed - 10), it shouldn't do sharp turns at max speed, in my opinion. Or would that create issues when other property settings are used?

PascalLadalle avatar Jun 03 '22 10:06 PascalLadalle

I agree that having a different behavior at 99% and 100% of the max speed is an issue, but using only one of the 2 formulas make things weirder. We should probably take time to do some researches to see how games do it.

D8H avatar Jun 03 '22 11:06 D8H