[SOLVED] Shaky Player with "Separate two objects" event

Hello, it’s been some time since I last posted. Some things have changed, just as the challenges did, namely how my player object shakes so much when using the “Move object away from object” event to handle collision in a top-down genre game. Example of such is provided in this link https://imgur.com/a/xC68q9D

When I force the player object against the blocker object, it is repelled in such a way that it shakes a lot, which would be highly undesirable. The best result would be for the player to simply not advance further from the point of collision with the blocker. Is there a way achieve that result? Thanks in advance.

You could try and use the “Stop Object” with the “Separate Two Objects” event as shown in this video (towards the end) Part 5 - Adding Furniture and Using Hitboxes

1 Like

Unfortunately, that didn’t work.

Hey,
Does it happen on any wall or only certain parts?
If you look at the isometric example, which uses the same action, you’ll see it’s very smooth, there’s no bumping. Do you use custom hitboxes?

1 Like

It doesn’t happen in every wall, only certain parts. The isometric example is indeed very smooth in most parts, shaking the character only at corners. On my test room though, it’s mostly everywhere except a few parts not shown. I believe is has somehow to do with angles and such.

I have devised a solution and plan on implementing it soon to test. It involves a few tricks I used in an abandoned project. It involves creating 1 pixel wide or tall objects at each side of the Player hitbox, and reversing the conditions of “Object is in collision with object” and adding the second condition of “Key is pressed”. What I hope to achieve with this is to make the key that’s pressed to go up won’t work if the “Up” object at the top of the player hitbox is in collision with a wall/obstacle. Would be nice if there was an action called “Disable a key”.

Have you tested with this experimental version of gd ?

1 Like

Oh I’ve seen this, I’ll test it today and report back the results.

EDIT: unfortunately, the effect persists even in the experimental version.

I have made the tests I said I would, below are the results:

What I envisioned somewhat worked. I placed 4 different objects representing each side (though not overlapping the corners, very important) to detect which side is touching the walls. If it’s touching the wall, the events make it so the key to that direction is disabled. The events in question:

https://imgur.com/a/txg7gPZ

There are still 2 problems:

  1. The Player object, still ‘wiggles’ if pressed against a wall, even if only once for a brief period of time;
  2. The above is not true if the angle of the obstacle is subtle. That means I will only be able to work properly creating obstacles whose angles are of specific degrees (90° seems fine-ish, 45° too);

A small demonstrative video is shown below:

https://imgur.com/nFAUD2u

This is not optimal, but it’s better than before. I’ll attempt creating smooth collision employing other actions other than the “Separate two objects” as a collision handling technique, changing the type of the obstacles to “Platform”, though I’m not sure they will mix with the “top-down movement” behavior from the player.

EDIT: I’ve successfully made the ‘wiggling’ go away by setting the wall to be a “Platform” and the player to a “PlatformerObject”, though it only works on the X axis, the actions to simulate up and down key presses bearing no fruit in that regard. Help in making the player move on the Y axis as a “PlatformerObject” will be greatly appreciated, but for now, I’ll try to make the “Player” both a “PlatformerObject” and have top-down movement behavior.

EDIT 2: After some testing, I’ve discovered much of the vibration was due to the rate at which my player object accelerated (very fast, 999999 value to be exact, as I wanted instant acceleration/deceleration). I’m not sure where to go from now on. I’ll keep testing with lower speeds and see what happens.

1 Like

The issue with the jiggling/wiggling/vibrating side effects have completely disappeared (even if the player is at high moving speeds) as soon as I made the following changes:

  1. Changed the player object to “PlatformerObject” only;
  2. Reduced gravity to 0;
  3. Disabled default controls;
  4. Set the obstacles to be “Platform” objects;
  5. Added specific controls that adds an instant force to the player for all 4 directions;
  6. Removed the “Separate two objects” action;

This way I’m able to mimic top-down movement with the advantage of not having to use the “Separate two objects”, which seemed to “repel” the player causing it to shake so much even at relatively slow movement speed. This works most of the time but new problems arose, which may require a new thread specific for that problem, so I’ll consider this issue with the shaky player object as solved.