Flak 38 first-person camera is not aligned to sights

Issue #392 resolved
Colin Basnett created an issue

The Flakvierling 38 has a bone called Object002, which matches the pitch of the turret. Note also that the Camera_com bone is a child of the SightBone, so that it moves with it.

In the class DH_Flakvierling38Cannon, this bone is referenced as the SightBone, and is updated in the following function.

// New function to update sight & aiming wheel rotation, called by cannon pawn when gun moves
simulated function UpdateSightAndWheelRotation()
{
    local rotator SightRotation, ElevationWheelRotation, TraverseWheelRotation;

    SightRotation.Pitch = -CurrentAim.Pitch;
    SetBoneRotation(SightBone, SightRotation, 1);

    ElevationWheelRotation.Roll = -CurrentAim.Pitch * 32;
    SetBoneRotation(ElevationWheelBone, ElevationWheelRotation, 1);

    TraverseWheelRotation.Pitch = CurrentAim.Yaw * 32;
    SetBoneRotation(TraverseWheelBone, TraverseWheelRotation, 1);
}

I notice the Flak 38 doesn't have this bone, so the rig will need to be altered to match the functionality of the Flakvierling 38.

Comments (3)

  1. Colin Basnett reporter

    Note also that there is a Elevation and Traverse wheel bone; this is fluff more than anything and can be ignored.

  2. Matt Hands

    I'll re-rig and re-make the animations after Peter has re-scaled the meshes.

    Making animations like these is pretty straightforward, although it's fiddly and annoying.

    Rigging a vehicle-related mesh is also pretty simply, but unfortunately MilkShape uses different axes, which can't be altered to match the Unreal engine. As soon as you touch anything to do with the bones in MS, it screws up the mesh & all anims (specifically it screws up all the bone's initial rotations, so they are no longer zeroed on the correct axes). I've found a way of getting over that, by exporting the rigged mesh as a text-based .SMD file format, then manually correcting the bone rotations as text values, then re-importing the .SMD back into MS & exporting as .psk Unreal skeletal mesh file. Very fiddly & a frankly a big pain in the arse, but it works ! I'm only going to do it once ........

    I'll include traverse & elevation wheel bones, like the flakvierling. It is fluff and it looks like unnecessary processing, but it's only on the client (which can easily cope). And I've moved the bone rotation update code from Tick() into HandleTurretRotation() and only running if there has been a cannon yaw or pitch change, so most of the time nothing is happening & it's efficient.

  3. Matt Hands

    Fixed in commit b4d703e and SVN revision 761, as part of re-make of the FlaK 38 animation file, including re-scale of meshes, re-rigging & re-making all animations.

    Meshes re-scaled with 50% increase. I scaled against barrel length of existing flakvierling mesh and needed exactly 50% increase to match that. Which is almost too much to be a coincidence; looks like model was made to two thirds scale. This of course assumes FV model is correct scale, but both models look & feel about right to me.

    Re-rigged, with camera bone parented to sight arm, so camera position is now correct on open sights. Also added traverse and elevation wheel bones and added rotation functionality in code, similar to flakvierling.

    Stripped skeletons of all 3 meshes down to a functional minimum, to avoid clutter and processing load (including on server, as has to track movement, position & rotation of all bones). Bones deleted:

    • turret_placement - serves no purpose; has nothing to do with turret attachment (turret origin attaches to base's attachment bone; no turret bone is involved) *com_attachment - gunner doesn't move, so no need for this bone, can simply attach to yaw bone and offset as required
    • com_player - not used & a generally unnecessary bone, only used to position hatch fire effects that aren't relevant to an AT gun (and even in a vehicle they could be attached to another bone)
    • trailer's left & right wheel dummies and rear 'wheel' - unused & can't see a purpose
    • trailer's BodyB - was used as a separate bone to assign the static base part of the mesh, but have assigned to trailer's turret_placement - no current function but idea is that if functionality is added to deploy from the trailer, any animation that moves the static base off the trailer will move the turret_placement bone, and so move the turret.

    I've left the currently unused wheel bones in the trailer base. No current function but would allow the wheels to be animated if Peter gets a mobile FlaK 38 later ! :)

    Centred all meshes in X & Y, then removing unnecessary X & Y bone offsets on bones that centre on X and/or Y.

    Added new anims for transitioning to/from the gunsight optics.

    Included 3 firing anims, using new generic functionality added to cannon class ('closed', new intermediate, & 'open').

    Also renamed the firing anims on the flakvierling for consistency. Flakvierling would benefit from some attention, but will handle separately, with a 'polycrunched' version of the FV turret by Peter.

  4. Log in to comment