KK_Plugins icon indicating copy to clipboard operation
KK_Plugins copied to clipboard

[AI/HS2] Colliders inaccurate

Open Avvilimento opened this issue 2 years ago • 1 comments

Currently it appears that the Colliders mod is applying at least some of its calculations based on an over-sized or misplaced meshes/nodes. Weirdly it doesn't seem to be consistent between AI and HS2 but both are ultimately affected.

In both titles, there appears to be some unusual interaction with the forearms in Sex Scenes. The "low" variant of the Desk Missionary position shows it quite clearly, especially with a large-busted character, but any position where the girl's arms are near her breasts will be affected. Disabling Breast Colliders immediately removes the distortion, though obviously does nothing against clipping.

AI, however, shows distortion in the Character Maker as well. Even on pose 1,with her arms to the sides, the colliders interfere - larger breasts are forced towards each other, while smaller breasts will jitter. Using ABMX to adjust the colliders only showed a meaningful interaction upon increasing the X scale value for the upper arms. This additional interaction also seems to be present in the aforementioned Desk Missionary position scenario. It's for this reason alone that I'm less inclined to suspect interaction with another mod, though obviously that's still a possibility.

Perhaps also worth mentioning is that the "world" interactions for the colliders in AI don't show the same misbehaviour; or at least nothing as obviously out of place.

All tests conducted using v1.2 of the Colliders mod and the latest "BetterRepack" release.

Avvilimento avatar May 05 '22 18:05 Avvilimento

The colliders are extremely fiddly and can't really be adjusted to be perfect. They are adjusted to work decent for KK/KKS models but AI/HS2 version didn't get as much attention I believe. If anyone wants to try fixing this, here's the data you need to tweak.

ManlyMarco avatar May 30 '22 17:05 ManlyMarco

I've had another chance to take a look at this... and I'm not sure I can offer any useful information, though I can perhaps offer some.

The issue as best I can figure stems from the forearm colliders. Adjusting their size alters the distortion, and removing/disabling them also removes the distortion entirely - though obviously that re-introduces potential clipping into the forearms. What I can't explain is that lowering the radius (even to 0) adjust the distortion as expected, but has little meaningful impact when the girl is laying down with her arms bent up at her sides. It's behaving as if the collider is mounted in the wrong place when the bone is at certain angles.

I find myself at even more of a loss when trying to use the studio for diagnostics - mostly because the studio works. After adding DynamicBoneFix from KK to fix the jitter caused by exceeding 60fps, everything looks and adjusts exactly as you expect that it should. I've verified that this is not a plugin conflict by unloading everything save what is necessary for the colliders to function, so unless the models are slightly different in-game as compared to the studio I have no idea what's going on.

Unfortunately that's about the limit of my diagnostic ability without the ability to visualise the bones and colliders themselves in-game. I don't know enough about Unity or C# to push much further into it.

Avvilimento avatar Nov 19 '22 08:11 Avvilimento

Okay, so I have more findings which don't mesh with the above.

I tried removing the arm colliders from the mod entirely (managed to fumble that with my antiquated Pascal knowledge). Commented out lines 47 and 48 of Core.Colliders.Controller.cs so they're never added, and verified the references are gone in-game using the cheat mod. This confirmed my earlier finding that there are existing colliders in the arms (two upper, two lower, for each arm) which interact with the breasts with the Colliders mod active.

However this also continued to show the same distortion as before, which I feel removes the mod's arm colliders as being the source of the issue entirely (and likely also means they are superfluous). Adjusting the size of the built-in colliders also adjusted the distortion, so perhaps it may be necessary to adjust these (they are "wider" than the mod versions) or perhaps there's an issue with the Mune colliders (there are some straight line ones I don't understand the purpose of).

Avvilimento avatar Nov 21 '22 18:11 Avvilimento

This plugin was originally made for KK which didn't have the colliders, it's likely the colliders got added in AI/HS2 and no one noticed when porting the plugin, or they got added by a later game patch. You could make the plugin disable the built-in colliders in that case.

ManlyMarco avatar Nov 22 '22 03:11 ManlyMarco

Here's where my lack of recent programming experience (and complete absence of Unity experience) comes to the front: I've no idea how to do that.

But I have established why I was getting conflicting results. HS2 and AI have different default arm colliders - both have an upper arm collider (cf_J_ArmUp02_s_L and R), but AI also includes lower arm colliders on top (cf_J_ArmLow01_s_L and R, and cf_J_ArmLow02_s_L and R). As a result, disabling the plugin lower arm colliders in HS2 would leave nothing behind, where AI would still have forearm collisions.

By virtue of that discovery I have found that a radius of between 0.05f and 0.07f works well, with a preference towards the lower end to distort less at the expense of some minor clipping. Visually (per StudioNEO in AI) this seems extremely narrow, especially compared to the default 0.40f and 0.30f, but it seems to work. The default upper collider seems to cause no issues despite appearing too wide (default 0.50f), but the plugin default 0.25f also shows no significant increase in clipping and is likely better overall. 0.25f (AI default 0.3) also shows no ill effects for the hand radius. It's only the forearms that have a problem.

Something weird is still going on, though. I don't understand why the forearm colliders are behaving differently in H scenes as compared to anywhere else (Studio, maker, or conversation) - whether they're part of the base game or the plugin. It's like they're offset from the bone they're supposed to be attached to (perhaps a counter-offset is required?) or even anchored at an angle from the wrong end.

Avvilimento avatar Nov 22 '22 17:11 Avvilimento

H Scenes have a bunch of extra code that is meant to adjust the body to fit the animations, mostly by IK. I'd guess it affects colliders in some way.

Feel free to submit a PR with your changes, I don't know much about this plugin so you're in a much better position to do it.

ManlyMarco avatar Nov 23 '22 22:11 ManlyMarco

Merged fix https://github.com/IllusionMods/KK_Plugins/pull/165 Sorry it took so long.

ManlyMarco avatar Mar 27 '23 20:03 ManlyMarco