• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code [Help] Viewport misaligned

TheMutant

Grizzled Veteran
May 31, 2012
556
3
Germany
Hello community,
I subclassed a new gametype (from KFGameType) that uses a new PlayerController (subclass from KFPlayerController) to integrated a respawn system.
It works pretty well, but sometimes the viewport is misaligned after respawning. It seems that the camera has a wrong rotation and sometimes even a wrong location.

I have neither an idea which causes this problem nor how to fix it. Does anyone of you know a solution?

Thanks in advance.
 
Hello community,
I subclassed a new gametype (from KFGameType) that uses a new PlayerController (subclass from KFPlayerController) to integrated a respawn system.
It works pretty well, but sometimes the viewport is misaligned after respawning. It seems that the camera has a wrong rotation and sometimes even a wrong location.

I have neither an idea which causes this problem nor how to fix it. Does anyone of you know a solution?

Thanks in advance.

It sounds like that bug that happens when you die while the screen is being punched; it returns to normal after another screen punch (melee hit is the easiest way to do it)

If your bug has the same origin, it would be interesting to find a way to fix it for the actual game too
 
Upvote 0
It sounds like that bug that happens when you die while the screen is being punched; it returns to normal after another screen punch (melee hit is the easiest way to do it)

If your bug has the same origin, it would be interesting to find a way to fix it for the actual game too

I did not know that this also concerns the main game. So then it's maybe more complicate. Maybe the ShakeView() won't reset properly. It happens quite often when the patriarch kills me with the chaingun.

As far as I know UT2004 had not such a bug, so it has to be something that Killing Floor brings with. I guess that the bug is within one of those files:

  • KFPlayerController
  • KFPawn/KFHumanPawn
 
Upvote 0
I did not know that this also concerns the main game. So then it's maybe more complicate. Maybe the ShakeView() won't reset properly. It happens quite often when the patriarch kills me with the chaingun.

As far as I know UT2004 had not such a bug, so it has to be something that Killing Floor brings with. I guess that the bug is within one of those files:

  • KFPlayerController
  • KFPawn/KFHumanPawn


I just think that TWI didn't foresee the event that someone would die during ShakeView(), thus stopping it prematurely and leaving the player with a wonkified view
 
Upvote 0
Yes, it is definately PlayerController.ViewShake() that causes this bug. When the ShakeView becomes interrupted by dying the viewport will be misaligned afterwards.

Do I have access to the camera via UnrealScript? Which variables controls the rotation/location of it?
It should be kinda easy to set it to the new pawn's rotation/eyelocation, shouldn't it?
 
Last edited:
Upvote 0
Yes, it is definately PlayerController.ShakeView() that causes this bug. When the ShakeView() becomes interrupted by dying the viewport will be misaligned afterwards.

Do I have access to the camera via UnrealScript? Which variables controls the rotation/location of it?
It should be kinda easy to set it to the new pawn's rotation/eyelocation, shouldn't it?

Edit:
It seems that I could fix that bug by just resetting two variables of PlayerController after dying:
CalcViewLocation = vect(0,0,0);
CalcViewRotation = rot(0,0,0);


amen

send this to yoshiro
 
Upvote 0
I don't know if this fixes the bug 100%, it hasn't occured to me since I implemented that. Anyway this is a ugly thing that just removes the effect of the bug but does not fight the source of occurrence.
It's enough for my small project but would be ugly when done the same way in Killing Floor. This is just not smart programming if you know what I mean. ;)
 
Upvote 0
I don't know if this fixes the bug 100%, it hasn't occured to me since I implemented that. Anyway this is a ugly thing that just removes the effect of the bug but does not fight the source of occurrence.
It's enough for my small project but would be ugly when done the same way in Killing Floor. This is just not smart programming if you know what I mean. ;)

I don't think so, I think that the origin of the bug was indeed that the punching vectors weren't reset when someone dies, thus leading to wonky angles
 
Upvote 0
"CalcViewLocation" and "CalcViewRotation" are not used in ShakeView(). There are extra variables that control the effect.
I don't know it exactly, but "CalcViewLocation" and "CalcViewRotation" seem to just hold the camera information. As both are used in several functions I just guessed to reset them without having knowledge of all the consequences. :)
A more flexible ShakeView() that can be interrupted would be the better fix.
 
Upvote 0