Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Alternative to RigidBody and CharacterController.

Discussion in 'Physics' started by Zimaell, Mar 3, 2024.

  1. Zimaell


    May 7, 2020
    Tell me what scheme (logic) for constructing checks should be in order to check collisions and ground, without RigidBody and CharacterController.

    I'm trying to do the following:

    1. Using Physics.CheckBox I check the future position, the box itself is of size (0.6, 1.5, 0.6) and is also raised by 0.4, the character itself is 1.9 high, if there is no obstacle, then I shift the position.

    2. using Physics.BoxCast, from the same box that I checked, I shoot a beam down, thereby checking whether there is a rise or a precipice, if there is a rise, then I raise it to a distance from the ground, and if there is a precipice, then I take away gravity.

    in the end, small hills and stairs can be climbed perfectly, but gradually increasing mountains bring problems, I can’t calculate them, I still can’t understand how to calculate them correctly...

    I tried to take into account the angle obtained from the point of contact, but this does not work, because if you block all angles exceeding the threshold, then small protrusions may also fall under this threshold...