Collision problems

Everything about development and the OpenMW source code.
User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Collision problems

Post by wareya » 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?
Last edited by wareya on 09 Jun 2018, 16:19, edited 1 time in total.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Re: Collision problems

Post by wareya » 09 Jun 2018, 16:02

These changes fix http://bugs.openmw.org/issues/1638 even if a cylinder is used instead of a capsule. Capsules also cause http://bugs.openmw.org/issues/4447 because of the round top. I think that OpenMW needs to use a collision shape with a flat top for actor-world collisions, even if it ends up being a shape that looks like a capsule on the bottom and a cylinder on the top.

...Actually I didn't check the state of the current master with cylinders instead of capsules, I'll go do that.

Okay, scratch that, http://bugs.openmw.org/issues/1638 doesn't have problems with cylinders in master anymore.

Trying to figure out how to make any of the complex shapes in https://i.imgur.com/GethFru.png in bullet, but it doesn't seem possible. I could do the cylinder-top-capsule-bottom one, but doTrace() and findGround() would need to be changed to cast multiple convex shapes and pick the closest result.

I made a very robust 3d movement solver from scratch once. You can skim it here and here, or watch a youtube video showing it off here and here (note: the control mechanics aren't part of the movement solver). I could try to port it over to OpenMW, but I don't want to undertake that kind of major overhaul without getting advice first.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Re: Collision problems

Post by wareya » 09 Jun 2018, 19:54

I think vanilla morrowind has ceiling collision height correction by race but does it backwards. I made a slowly descending series of floating crates to test collision hull height "in practice".

https://imgur.com/a/Ou6G2UE

The first two images are how far I can go as a bosmer. The rest are how far I can go as a high elf.

This is how far I can go as a dunmer in Vanilla: https://i.imgur.com/5hRPsuV.png

I go further than that in current master, but it causes the player to get stuck because of how the ground offset logic works. I have a fix for this in PR #1733 now. (My personal branch already fixed it.)
Last edited by wareya on 09 Jun 2018, 20:34, edited 1 time in total.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
lysol
Posts: 1010
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Collision problems

Post by lysol » 09 Jun 2018, 20:12

Great research. Don't really have anything to add, but I'm gonna continue lurking this thread.
Normal mapped texture replacers, exclusive for OpenMW:
My Nexus page

User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Re: Collision problems

Post by wareya » 10 Jun 2018, 01:49

The collision normals that OpenMW is getting out of bullet are very inaccurate (sometimes a perfectly flat floor triangle is given a z-axis normal of 0.9994) and it's causing problems.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Re: Collision problems

Post by wareya » 10 Jun 2018, 03:36

Using a btMinkowskiSumShape of a cylinder and a tiny sphere is way more stable than just using a cylinder.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
psi29a
Posts: 4078
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: Collision problems

Post by psi29a » 10 Jun 2018, 11:10

What do these things look like? What do you mean by more stable? That things behave consistently?

User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Re: Collision problems

Post by wareya » 10 Jun 2018, 13:08

A btMinkowskiSumShape of a cylinder and a tiny sphere is basically a cylinder with round corners.

Actors get stuck on simple geometry less often with it than a cylinder.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
akortunov
Posts: 356
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation
Github profile: https://github.com/akortunov

Re: Collision problems

Post by akortunov » 10 Jun 2018, 13:11

wareya wrote:
10 Jun 2018, 13:08
Actors get stuck on simple geometry less often with it than a cylinder.
As with capsules, which we currently use? The capsule is a "cylinder with round corners.", right?

User avatar
wareya
Posts: 204
Joined: 09 May 2015, 13:07

Re: Collision problems

Post by wareya » 10 Jun 2018, 13:23

A capsule is a cylinder with spheres stuck to the ends. Here.

https://i.imgur.com/7FYYFIv.png

Cylinder, capsule, Minkowski sum of a cylinder and a small sphere.

I can't take pictures of the Minkowski sum ingame because it doesn't render with togglecollisionboxes for some reason. I assure you that it collides correctly, though.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests