SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
83 stars 17 forks source link

Continuation on bad left handed character item scaling #4445

Closed DerpyHoowes closed 6 days ago

DerpyHoowes commented 2 weeks ago

Adding up on this problem I stated in https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/4409 since this one got closed.

Rigged items seem to have problems when getting scaled for the left handed characters, because they get inverted, as if they're scaled -1 on Y axis too, not just the X one. Sometimes it affects multiple bones, sometimes only several of them, depending on item. I wasn't able to pin down why its so inconsistent. I've made a lot of items like these already. and even with the rifle using same handling animations as one shown on the video, this bug isn't hapenning, so I'm clueless what exactly causes it.

Left_Handed_Characters_Mirror_Equipable false is a bad solution, because not only does it ruin some of the animations because movement of the hands doesn't match the item itself, it also prove to not even fix the original issue, because as can be seen in the attached video, it gets rescaled to (1, 1, 1) after a shot or reload in case of this projectile weapon I made, and only after reload in case of hitscan weapon. Not sure if its a rule or just a coincidence as well, simply because these are the only items I know of having this issue in my mods (I play as righthanded character so I only know of these from reports by players who use left handed mode).

https://www.youtube.com/watch?v=JoxCrpNF5AQ

SDGNelson commented 2 weeks ago

I don't think this is something to fix in the base game since it sounds like it's a case-by-case issue with certain items. Do any of your animations perhaps keyframe the item root which otherwise has its transform set once during instantiation? Another possibility: If your animation doesn't explicitly set all bone transforms at the start of each animation they will retain their transform from the previous animation.

DerpyHoowes commented 1 week ago

Well yeah, obviously they're keyframed since I use Key all Bones on export. When I tried exporting animation with only keying the bones used in animation (that would usually be Left and Right Shoulder, Arm, Hand and Hook) to make the exported animations take less drive space, it caused aiming issues that I stated in https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/3539 so after that I never even bothered with doing that, seeing how for some reason it breaks the animation. So there's kind of no way for me to not have this property keyed by animation.

SDGNelson commented 1 week ago

I haven't personally used this, but it looks like the Mask setting in the Animation import tab might work for it: If you uncheck specifically the item prefab in that hierarchy does it exclude them?

DerpyHoowes commented 1 week ago

Turns out for some reason I had a Parent constraint on the rifle root bone, which wasn't supposed to be there. Parent constraint is also the way, how I made the rocket launcher magazine follow the animated bone. So as, it seems, its the Parent constraint that works bad in negative scale transform. Now I know its not something game code related at this point, but any idea how to fix it?

SDGNelson commented 1 week ago

A parent constraint on the EquippablePrefab root / Item prefab? So after removing that the root animation is okay now?

As for the magazine: The way some maps have implemented this is by animating the child of the weapon directly. For example, animating Right_Hook/ (instantiated weapon name) /Magazine or Right_Hook/ (instantiated weapon name) /Magazine/ (instantiated attachment name) - is that an option in your case? Or which bone are you animating and then using the parent constraint on?

DerpyHoowes commented 6 days ago

Yeah thats a useful piece of advice, thanks!