Player automatically hops on Slime Critter when walking into it

Short description
Very minor issue, but if the player is walking into the Slime Critter (which can happen if you are attacking while moving) or any other small objects with similar colliders (i.e. bushes), they will automatically hop up. This can make fighting the Slime Critters pretty awkward if you’re facing them head on.

Expected behaviour
Player will stay on the ground as it walks around the Slime, just like how they walk around the Plant Critter.

To Reproduce
Steps to reproduce the behavior:

  • Set player health to an absurdly high number to avoid death while testing (optional)
  • Open TestingGround or any gameplay scene.
  • Approach the Slime Critter (or one of the bushes) and walk/run into it
  • Player will sometimes forcibly hop as if trying to get over it

Notes

  • The following video shows the typical occurrence of the bug as you try to walk into a Slime Critter:
  • The bug is easier to reproduce if you disable the AI of the Slime Critter and just keep walking into it, like this:
  • As mentioned before, this isn’t just limited to the Slime Critter. You can reproduce this bug with any small physical object as you can see from the bushes here:
  • I did notice that this does not happen when walking into the Plant Critters. The player just walks around them as shown here:

Hi! New contributor here, just installed Unity for the first time and am still trying to make sense of it all. This seemed like a nice simple bug to start on.

I’ve been experimenting with the game, and as far as I can tell the issue with the player avatar hopping around the slime has to do with the slime’s collision zone. As you can see below, it’s a sphere that fits the character model quite nicely, but apparently our pig chef sometimes hits the sphere and thinks “this collision is low enough that I can just step upward” and the momentum somehow carries them way up into the air.

The plant critter, on the other hand, has a very tall capsule-shaped collision zone. This seems to do the right thing at ground level, but note that if you stood on the rock to the left of the image and tried to hop over the plant, you’d crash into an invisible cylinder in the air above it.

The answer is probably to just change both critters’ colliders to be capsules that fit snugly around the character models. Gonna give that a try tomorrow. :slight_smile:

How about making the top of the collider a cone which is steeper than 60 degrees? You could try that as well. In this case the player can hop on it but will slide down, which would be possibly right for such sippery creature.

Would you need help making such a collider?

I like the slippery slime idea! I also wonder if trying to land or stand on the creature’s top should damage the chef, what with all the spikes. I think I can figure it out, but I’ll post here if I get stuck.

As for the original hopping bug, it looks like the magic number is .37 … if I increase the Y-coordinate of the sphere’s center to .37 , then the chef treats the slime critter as a proper obstacle. Here’s the git branch where I’m playing with this stuff: GitHub - pointfivetee/open-project-1 at bugfix-slime-hop

Update: I shortened the plant’s capsule and now the chef can stand on top it while the plant tries in vain to attack them. Not sure if this is the desired behavior, but I found it entertaining.

Ok, the small bushes were a bit trickier. If I tried making the collider tall enough to avoid the hopping/sliding behavior, then one could jump on top of it and hover visibly in midair over the bush. Not ideal.

I managed to solve the problem by giving the bush an additional tall capsule collider that turns into a trigger (thereby bypassing the physics engine) when the player enters a spherical trigger zone above the bush. This setup eliminates the weird hopping/sliding behavior around small bushes while still allowing you to jump up onto them normally.

Here you can see the two new colliders:

7245239--872789--Screen Shot 2021-06-16 at 6.19.49 PM.png

(Not pictured: the original collider, which hugs the mesh more closely and is always "on".)

This might be overkill for fixing a humble bush? But it was a good learning experience, anyway.

Sharing it here also on the thread, as I mentioned on Github comments, we are working on fixing the character controller first since we have some unpleasant situations like mentioned on the issue or when the character gets stuck so we will try to fix that first and then we can work on the minor issues with the colliders on the objects. Thank you all :slight_smile:

1 Like