Slide across walls

Discussion in 'Unity Support' started by GizmoBradwell, Apr 13, 2012.

  1. GizmoBradwell

    GizmoBradwell

    Member

    Joined:
    Dec 27, 2010
    Messages:
    64
    There's lots of posts on this and i've tried physics materials, but I can't get a real resolution to this basic requirement.

    What do I need to do to get my first person to slide across walls, not be slowed down by them?

    I'm using the standard first person controller, if this is the problem and there's a setup that works, would someone kindly help me to not reinvent the wheel.

    Thanks for the help! :)
  2. diablo

    diablo

    New Member

    Joined:
    Jan 3, 2011
    Messages:
    736
    Slide scross walls and not be slowed down? I don't understand what this means; would you give us an example?
  3. GizmoBradwell

    GizmoBradwell

    Member

    Joined:
    Dec 27, 2010
    Messages:
    64
    When you walk into a wall at an angle with the first person controller, the wall slows you down rather than freely sliding across it. You get the feeling of getting stuck when you go near a wall. Make sense?
  4. diablo

    diablo

    New Member

    Joined:
    Jan 3, 2011
    Messages:
    736
    Hmmm... I think I see what you're saying, but that would be pretty unrealistic. What do you expect to happen if the player is running almost perpendicular to the wall, such that there's only 1 degree of bias towards the right? Do you expect him to slide to the right as if he were running parallel to the wall?
  5. diablo

    diablo

    New Member

    Joined:
    Jan 3, 2011
    Messages:
    736
    Or do you mean that he's stuck at one point and won't budge at all, and you want him to slide very slowly to the right?
  6. Alienchild

    Alienchild

    New Member

    Joined:
    Oct 14, 2010
    Messages:
    364
    Seen from a non-game perspective, part of the force moving the player forward when you walk into a wall at an angle goes into "friction" so to speak. In Unity I think that the forward velocity somehow gets translated based on the angle of the wall when the two colliders collide. This is purely a guess though, but I guess this happens internally somehow in the physics simulator. So basically you have to get around that. Normally with no physics I suppose when the collider hits a wall it would come to a dead stop, no matter if the wall is at an angle. So basically what you could do is to rotate the players move direction dynamically based on collision angle. That might cause a whole heaps of other problems though.
  7. diablo

    diablo

    New Member

    Joined:
    Jan 3, 2011
    Messages:
    736
    Assuming I'm correct in my assumptions I previously posted, then I would guess that the solution would involve detecting the collision, getting the collider's transform, and deducing the angle of the player in relation to the wall's collider, and applying the right amount of movement correction according to the slope.
  8. GizmoBradwell

    GizmoBradwell

    Member

    Joined:
    Dec 27, 2010
    Messages:
    64
  9. diablo

    diablo

    New Member

    Joined:
    Jan 3, 2011
    Messages:
    736
    That's good to know!