Glitched camera location after firing cannon in periscope position on Sherman 105 & jumbo

Issue #95 duplicate
Matt Hands created an issue

Firing cannon while on periscope plays TankShootClosedAnim, which lowers camera bone back to cupola position, resulting in glitched view with periscope textured overlay inside the cupola.

Bug affects tank cannons that have both a cupola and a periscope view, unless cannon pawn's Fire function has been modified to prevent firing when commander is on periscope. This applies to the Sherman 105 and the jumbo.

German tanks with cupola and periscope are not affected as all are modified to prevent firing when on periscope (jagdpanther, stug, stuh, JP4, hetzer). Other tanks with periscope but no cupola can all fire while on periscope.

So secondary problem is inconsistency in whether commander can fire from periscope position in different tanks.

Comments (2)

  1. Matt Hands reporter

    There are only 2 cannon firing anims: one with the hatch closed, one with it open. The firing anim must include its own locations for the camera & player attachment bones and has to assume a default bone pose for the buttoned and for the unbuttoned positions. This causes a problem if the firing anim moves these bones from their current location.

    TankShootOpenAnim isn't a problem as the only other possible unbuttoned position is binoculars, which doesn't move any bones. But TankShootClosedAnim can cause problems as there may be multiple buttoned up positions. The gunsight position isn't a problem as that always uses its own camera location, offset from the default buttoned bone pose. And tanks that only have either a cupola or a periscope are made with anims with a default buttoned pose for that position, so no problems there.

    But for tanks with cupola & peri, the default buttoned pose has to be for either cupola or peri, and in practice is for the cupola position. This means that on the peri, the TankShootClosedAnim reverts the camera bone back to the cupola position, which is lower & inside the turret. So firing the gun results in a lowered camera location, showing an internal cupola view, but with the peri's textured overlay drawn over.

    Other allies tanks with a peri are not affected as they don't have cupola, so the peri position effectively becomes the default buttoned pose and the TankShootClosedAnim is made in that pose. Applies to all other Shermans and the Stuart and Cromwell.

    German tanks, on the other hand, are all prevented from firing from the peri position. The stug & stuh have both peri and cupola, so this actively prevents the glitch that affects the Sherman 105 and jumbo. But the JP4, jagdpanther & hetzer only have a peri, so this is an arbitrary inconsistency between German and allied tanks, as all allied tanks are allowed to fire from the peri position.

    I think the only sensible fix, without creating additional firing animations & changing the coding for problematic tanks, is to simply prevent all tank cannons from being fired when the commander is on a periscope. That also removes the inconsistency between German and allied tanks.

    There is also perhaps an argument for preventing any cannons being fired unless the commander is on the gun. Currently the commander can fire if he is looking through the cupola or is unbuttoned.

    in class DH_ROTankCannonPawn:
    
    // Modified so commander cannot fire cannon when he is on the periscope
    // Also optimised & made generic (tank commander marking an arty target on binocs removed, as DH's ServerSaveArtilleryPosition doesn't allow that from a vehicle)
    function Fire(optional float F)
    {
        local  ROTankCannon  Cannon;
    
        if (DriverPositionIndex == BinocPositionIndex || (PeriscopePositionIndex > 0 && DriverPositionIndex == PeriscopePositionIndex))
        {
            return;
        }
    
        Cannon = ROTankCannon(Gun);
    
        if (Cannon != none)
        {
            if (Cannon.CannonReloadState == CR_Waiting && ROPlayer(Controller) != none && ROPlayer(Controller).bManualTankShellReloading == true)
            {
                Cannon.ServerManualReload();
            }
            else if (Cannon.CannonReloadState == CR_ReadyToFire && Cannon.bClientCanFireCannon && Cannon.ReadyToFire(false))
            {
                VehicleFire(false);
                bWeaponIsFiring = true;
    
                if (ROPlayer(Controller) != none)
                {
                    Cannon.ClientStartFire(Controller, false);
                    ROPlayer(Controller).CheckForHint(4);
                }
            }
        }
    }
    
  2. Log in to comment