Search Unity

Physics.Capsule... Collisions??? How to bump out?

Discussion in 'Physics' started by From-Soy-Sauce, Aug 17, 2016.

  1. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    Hello, I understand that I can use:
    bool in_a_wall = Physics.CheckCapsule(top, bot, radius);

    To figure out if my player is inside a wall. Is there anyway to figure out where the capsule player needs to move to be able to be moved outside of any collisions? Specifically in the direction opposed from theoretical point that set in_a_wall to be true?

    I am trying to make a collision system that doesn't have the player use a rigidbody or a capsule collider or a character controller.

    A few more things:

    1) Is there anyway to make it so that Physics.CapsuleCast() includes the space that the player is currently occupying?

    2) How can I return the normal of the face that the RayHit of Capsule Cast outs to, in the way that a RayCast would? I noticed that .normal in the case of a Capsule Cast tends to rotate around the cast.

    3) Is there any effective way to use the information given from Physics.CapsuleCast() to move the player such that it will slide off walls appropriately?