0
\$\begingroup\$

Im trying to implement a basic 3d character controller. The way i currently do collision is; i check wether or not the character is inside any geometry before movement. If this is the case, i find the closest point of this geometry, and subtract the vector from the character to the point from the characters velocity. This works for some surfaces, but of course has a lot of issues. There are two that i am trying to figure out right now.

  1. If the character moves into a wall and the floor at the same time, it will be moved out in two frames, because they are seperate objects. One way to fix this is to do the check two times, but this amount increases by one for every object the character moves into, and i do not know the amount beforehand.

  2. If the character moves into a v shape, it will bounce back and forth between the two side each frame, because the collision detection moves it into the other side.

Does anyone know how these are commonly handeled?

\$\endgroup\$
4
  • \$\begingroup\$ What shape is your character's collision representation? For simple shapes like circles/spheres/capsules/boxes, we can often do a swept collision check - something like a raycast, that stops when it encounters the first obstacle. \$\endgroup\$
    – DMGregory
    Feb 19 at 17:55
  • \$\begingroup\$ It is a capsule. I have considered doing it in such a way, but am under the impression that it is a lot less efficient. \$\endgroup\$
    – aaaaaaaaaa
    Feb 19 at 18:02
  • \$\begingroup\$ If it saves you bugs, the cost might be worth it! \$\endgroup\$
    – DMGregory
    Feb 19 at 18:02
  • \$\begingroup\$ That's true, i will try it out and see. Thanks. \$\endgroup\$
    – aaaaaaaaaa
    Feb 19 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.