thegriglat wrote: ↑04 Dec 2017, 02:56
I'm not a C++ and/or OpenMW code guru
Hey, I'm no guru either, I've been here for about two months, but if you keep digging for long enough, you eventually find the source of the bug.
I've noticed before by writing out the camera position that if you rotate the camera, its position slightly changes, which is weird. This is a situation in which it actually shows. It's like the camera is rotating around a pivot point that's sligtly "behind" it for some reason, I don't know why that is. I think we should make the camera rotate without changing position to fix this, not change its height by some magic value (if that is what you meant by increasing the z coordinate). I'm gonna take a look at this in a minute.
thegriglat wrote: ↑04 Dec 2017, 02:56
but I'm a bit worry to touch them ...
I'm not pretending to merge this workaround -- it is more for me and better understanding of OpenMW code
You can make an incomplete pull request at GitHub and the experienced programmers will help you out and you'll very quickly get into it. They won't blindly merge anything, don't worry, and even if you break something, we can almost always revert the changes, that's what git is for =) So I'd say don't be afraid.
UPDATE: Here I'll keep my code digging notes:
- camera position is set depending on what getFocalPoint() returns
- getFocalPoint() returns position of mTrackingNode (helper node made solely for this purpose I guess)
- Looking at processViewChange() mTrackingNode for first person is set to some node of the character model: either "Camera" or "Head" if it's not found. I checked ingame and it's the "Head" node because "Camera" doesn't exist in the model. So the camera position is the head position, which I suppose is somehow animated when you're turning around. I don't know what else to attach the camera to though. Maybe we could create the "Camera" node if it doesn't exist?
- Indeed if I attach the mTrackingNode to a MatrixTransform node I create in NpcAnimation::updateParts() as a child of the NPC root node, the camera doesn't change position when rotating. I have to check if it fixes the water bug.
- It does, however only if my new camera attaching node is straight above the player root node. However the camera has to be also shifted a little bit forward in order for the hands to look good. If I do shift forward, the problem appears again, which is weird. It seems like the player root node is somehow slightly rotating (and so rotating my node along with it).
- I think it's some of the RotateControllers, but I've never seen these so I have to study it a little =)