Project

General

Profile

Bug #3803

[Mod] Sitting NPC mods collision issue

Added by Andrei Kortunov about 1 year ago. Updated 13 days ago.

Status:
Resolved
Priority:
Normal
Category:
Physics
Target version:
Start date:
03/24/2017
% Done:

100%

Reproducibility:
Always
Operating system:
Other
Severity:
Normal

Description

This issue easy to reproduce with Animated Morrowind 1.0 (http://mw.modhistory.com/download-55-6351).
Just type in console:

coc "Balmora, Council Club"
AM_Eater01->enable

Result:
NPC (Ular gro-Bashag) spawned at correct position, but game immediately "pushed" the NPC on top of a table (see screenshots).
"The regulars - Sitting NPC" plugin is also affected.

This effect based on bounding box instead of mesh dimensions, right?

NPC_is_just_spawned.png View (1.11 MB) Andrei Kortunov, 03/24/2017 10:11 AM

NPC_pushed_on_top.png View (1.11 MB) Andrei Kortunov, 03/24/2017 10:11 AM

Regulars.png View (1.21 MB) Andrei Kortunov, 03/24/2017 10:21 AM

Screenshot_20170502_221604.png View - Fisherman - works fine (2.74 MB) Andrei Kortunov, 05/02/2017 09:07 PM

Screenshot_20170502_221642.png View - Eater - pushed (2.85 MB) Andrei Kortunov, 05/02/2017 09:07 PM

Screenshot_20171213_113226.png View - Abot's Gondoliers (749 KB) Andrei Kortunov, 12/13/2017 08:35 AM

sitting.patch View - Patch to disable collisions for non-moving objects (5.48 KB) Andrei Kortunov, 01/21/2018 11:08 AM

History

#1 Updated by Andrei Kortunov about 1 year ago

I added some screenshots from Animated Morrowind: Expanded. See the difference between collision boxes.

#2 Updated by Andrei Kortunov 10 months ago

Can this issue be fixed on a resource side?

#3 Updated by N Kee 10 months ago

I also have encountered this many times when trying out mods. This occurs with basically any mod that includes sitting NPCs, such as Morrowind Comes Alive. I'd also like to see a fix if anyone can offer one.

#4 Updated by Andrei Kortunov 10 months ago

  • Status changed from New to Confirmed

#5 Updated by scrawl . 8 months ago

These mods basically rely on the fact that vanilla doesn't apply collision detection to actors that are not moving. The thing is, not doing so causes other issues (e.g. actors wouldn't fall if you remove the ground from under them).

#6 Updated by Chris Robinson 8 months ago

The engine really needs a "sitting" state (with "sittable" objects) like the later games to handle this properly, rather than relying on collision quirks of non-moving idle actors. In Oblivion, IIRC, furniture meshes would be marked with nodes that indicate where actors could sit, and it would allow the given actor's collision to meld with the furniture through masking or something. So an actor would activate a piece of furniture, their collision shape would be masked from furniture objects, then they'd play a sitting animation (which makes them go through furniture and appear to be sitting on it). When they're done sitting, they'd play a standing animation and then be unmasked from furniture objects to collide with them again.

#7 Updated by The Caconym 8 months ago

I can confirm I also have this issue with most sitting characters (those that collide with furniture or similar), latest openmw built from git.

I don't suppose there's any way right now - other than changing the source itself - to make openmw ignore collision detection to actors issued from a specific .esp ?

#8 Updated by Andrei Kortunov 8 months ago

The engine really needs a "sitting" state

Where we can store this state? In the animation NIF-file?

#9 Updated by Andrei Kortunov 8 months ago

In this case "doesn't apply collision detection to actors that are not moving" will become "doesn't apply collision detection to meshes that have a special flag".

#10 Updated by Chris Robinson 8 months ago

Andrei Kortunov wrote:

Where we can store this state? In the animation NIF-file?

In the mechanics manager somewhere. Similar to how we store a knocked-out or jumping state, it's just something that NPCs (and the PC) can do for specific behaviors.

In this case "doesn't apply collision detection to actors that are not moving" will become "doesn't apply collision detection to meshes that have a special flag".

Collision detection would still be applied. However, "sitting" actors would have their physics shape masked from furniture objects so they could move through them for their sitting animation.

#11 Updated by Andrei Kortunov 5 months ago

Abot's Goldoliers mod is affected too.

#12 Updated by Andrei Kortunov 5 months ago

If we do not want to use that quirk, can we add a console command to toggle collision for specific scripted actors?

#13 Updated by Andrei Kortunov 5 months ago

vanilla doesn't apply collision detection to actors that are not moving

Apply, but does not change actor postition and animation state. At least, "actor-actor" and "actor-projectlie" collisions are still there.

#14 Updated by Andrei Kortunov 5 months ago

FYI: related code is here.

#15 Updated by Andrei Kortunov 4 months ago

So what we decided to do? Mark such mods as "won't fix"?

For now I have to use the attached patch to workaround this issue.

#16 Updated by scrawl . 2 months ago

Actually it's common in physics engines to have idle objects/actors enter a deactivated state where physics don't apply to them. You just need to make sure they get reactivated if their ground stops existing. It shouldn't be too difficult to code that because we already have a 'which actor is standing on which object' tracker for scripting purposes.

I remember toying with the idea of adding a deactivation state just for a performance benefit. Then I realized that wouldn't do much for the vanilla game because practically all of the AiWander idle animations contain a small amount of movement in them. It would only work for animations with no movement at all, like (I hope) that sitting animation.

#17 Updated by Andrei Kortunov about 2 months ago

It shouldn't be too difficult to code that because we already have a 'which actor is standing on which object' tracker for scripting purposes.

There are another cases which we need to track, e.g. end of levitation or water walking.
Also our World::adjustPosition() implementation breaks animated actors - we need to place them precisely to position from ESM/ESP file, not a "slightly above".

#18 Updated by Andrei Kortunov about 2 months ago

This check in the beginning of PhysicsSystem::move() allows to workaround this issue without need to activate/deactivate physics for actor.

// Original engine does not apply collisions for non-moving actors.
// Early out, if the actor is on solid ground
if (movement.x() == 0 && movement.y() == 0 && movement.z() == 0)
{
    if (MWBase::Environment::get().getWorld()->isOnSolidGround(ptr))
       return position;
}

Not sure if this approach is good, or too heavy.

#19 Updated by Andrei Kortunov about 2 months ago

'which actor is standing on which object'

Is not really useful since the report is about case when an actor is inside other object.

#20 Updated by Andrei Kortunov 13 days ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Andrei Kortunov
  • Target version set to openmw-0.44
  • % Done changed from 0 to 100
  • Operating system changed from Linux to Other

#21 Updated by Randy Davin 13 days ago

Andrei is on fire man.. this bug is resolved at last.

Also available in: Atom PDF