playMaker

Author Topic: Character sliding without input after collision  (Read 1170 times)

Laralyn

  • Playmaker Newbie
  • *
  • Posts: 21
Character sliding without input after collision
« on: February 17, 2023, 02:52:57 PM »
I've got a scene set up with a floating sphere as the playable character, in a scene with a doorway that has an uneven stone texture. It's from the side view, so the sphere moves on the Z+Y axis. When the sphere collides with the uneven stone doorway, it seems to slide a bit and then go off course (along the X axis) even if you aren't giving it input. I'm using the new Unity input system, set to only control the Z and Y axis.

I'm pretty sure it's the collision forcing the sphere to try to slide around it, but so far the only thing that seems to stop it is building collision for the doorway out of multiple box collisions (so the thing the sphere collides with is flat). This sounds ultimately unsafe to depend on for my game.  :)  Things will really break if the sphere ends up wandering off along the X axis!

I've tried giving both the wall and the sphere a high friction physic material but it didn't help. I've attached an image of the actions I'm using for movement along with a screenshot of the wall so you can see what I mean by "uneven".

Is there something in the movement FSM that I can change to stop this, or is there a setting I'm missing somewhere? Or do I need to investigate code to constrain the sphere to a spline or some other method to guarantee it can only move along the Z and Y axis (and never slide or move along the X)?

Thank you!

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 256
Re: Character sliding without input after collision
« Reply #1 on: February 17, 2023, 09:54:58 PM »
In the rigidbody setting you can restraint the x axis. Have you tried that?

Laralyn

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Character sliding without input after collision
« Reply #2 on: February 18, 2023, 02:07:13 PM »
So simple! Thank you for responding so quickly. That fixed it.  :)