Collision problems
Posted: 08 Jun 2018, 14:36
On the back of https://github.com/OpenMW/openmw/pull/1733 I made a bunch of other changes to make collision smoother here:
https://github.com/wareya/openmw/commits/personal
but the first commit is a megacommit with some accidental/arbitrary changes in it and I plan to split it up into individual commits later.
First of all, it still has problems, and introduces a new one where walking along a wall very close to parallel to it but facing towards it ever so slightly gets you stuttering on it.
That aside, these are the problems it solves:
- There was no "fudge factor" anywhere, so any elaborate collision code would cause performance problems due to colliding with things it already collided with, relying on the block that moves the actor "outside" things it's touching
- The collision loop was not projecting the character onto what it hits when it hits something before sliding, if that something is not involved in the stair stepping code. This fixes an issue where, if the call to step() is commented out, standing still and jumping in place wouldn't map the actor to the ground, they would hover slightly above it, and several minor related issues with getting stuck on objects that characters should not get stuck on. This requires a fudge factor, as well as a fix to the code that places the actor 1 unit above the ground when on the ground.
- Acute crevices require special treatment, not just sliding along the surfaces. The code for this is nasty because the collision loop was not designed for it. This makes it so that "slides" made from acute crevices, like the double stairs in the ald'ruhn mage's guild, don't get the player completely stuck and unable to mve anywhere at all. This requires a fudge factor.
- The logic for not getting knocked upwards by very steep slopes (e.g. the sides of some beds) is better now (I think).
- The code that places the actor 1 unit above the ground when on the ground wasn't actually doing collision checks to do it, so you could get inside of very narrow sloped walls if projecting before sliding was fixed.
I don't intend to make a pull request with the code in this state, mostly because of that one problem it introduces with walking almost parallel to walls, but it fixes a whole host of other issues. Is this the right place to talk about this?
https://github.com/wareya/openmw/commits/personal
but the first commit is a megacommit with some accidental/arbitrary changes in it and I plan to split it up into individual commits later.
First of all, it still has problems, and introduces a new one where walking along a wall very close to parallel to it but facing towards it ever so slightly gets you stuttering on it.
That aside, these are the problems it solves:
- There was no "fudge factor" anywhere, so any elaborate collision code would cause performance problems due to colliding with things it already collided with, relying on the block that moves the actor "outside" things it's touching
- The collision loop was not projecting the character onto what it hits when it hits something before sliding, if that something is not involved in the stair stepping code. This fixes an issue where, if the call to step() is commented out, standing still and jumping in place wouldn't map the actor to the ground, they would hover slightly above it, and several minor related issues with getting stuck on objects that characters should not get stuck on. This requires a fudge factor, as well as a fix to the code that places the actor 1 unit above the ground when on the ground.
- Acute crevices require special treatment, not just sliding along the surfaces. The code for this is nasty because the collision loop was not designed for it. This makes it so that "slides" made from acute crevices, like the double stairs in the ald'ruhn mage's guild, don't get the player completely stuck and unable to mve anywhere at all. This requires a fudge factor.
- The logic for not getting knocked upwards by very steep slopes (e.g. the sides of some beds) is better now (I think).
- The code that places the actor 1 unit above the ground when on the ground wasn't actually doing collision checks to do it, so you could get inside of very narrow sloped walls if projecting before sliding was fixed.
I don't intend to make a pull request with the code in this state, mostly because of that one problem it introduces with walking almost parallel to walls, but it fixes a whole host of other issues. Is this the right place to talk about this?