In 5.6, some nice new features were added to FMotionWarpingTarget to provide some welcome new behavior, however, the implementation doesn’t seem to play very nice with the warp target struct being constructed independently, through for example a split struct, or via an API that takes the struct itself, like AddOrUpdateWarpTarget(const FMotionWarpingTarget& WarpTarget).
The EWarpTargetLocationOffsetDirection functionality relies on the calls to
CacheOffset(Transform);
RecalculateOffset(Transform);
which are only called in the FMotionWarpingTarget constructor
If you create the struct in blueprint for instance, and then add it via
UMotionWarpingComponent::AddOrUpdateWarpTarget(const FMotionWarpingTarget& WarpTarget)These function won’t be called, and the functionality you expect to occur will be broken.
The helper functions
UMotionWarpingComponent::AddOrUpdateWarpTargetFromComponentuses the constructor, and so should work, but there seems to be this gaping hole in the use of the struct itself that provides a code path for broken functionality, if you construct a FMotionWarpingTarget yourself and register it directly, and not through a helper function like the above.
Perhaps a custom make function is in order here?
Second, why is AvatarActor parameterized through the warp target rather than the URootMotionModifier use the owning actor and the target transform? Also based on the math it does in the code, I think it should be reversed EWarpTargetLocationOffsetDirection::VectorFromTargetToOwner should be VectorFromOwnerToTarget
Third, this new functionality is great and is welcome, however the implementation can be improved. Because EWarpTargetLocationOffsetDirection seems like it ought to be something that only alters the location of your warp target, but instead since it internally manipulates the target transform of the warp, it has side effects of breaking your rotation warps, forcing you to use multiple motion warp targets where you previously used 1.
For instance, we were commonly motion warping to the target actor, with the facing rotation type. It was an easy approach to ensuring orientation towards the target for purposes of attack animations and stuff, but if you use EWarpTargetLocationOffsetDirection, this rotation mode basically becomes useless, as close up melee attacks could be offset laterally or even backwards if you intend to maintain spacing offset. But what you don’t want to occur is for this offset to cause your rotation to turn away from the target. The existing rotation modes make sense, but to supplement the new offset modes, I think there needs to be some rotation modes that work on the non offset target transform, so you still have a mechanism to offset location without borking rotation.
Edit:
Also just noticed that I don’t think Epics own code dealing with cancelling follow accounts for offsets. This code needs to call FMotionWarpingTarget::GetTargetTrasform(sic) and store that result in Location/Rotation like the FMotionWarpingTarget
constructor does, before turning off follow, or else it doesn’t account for the offset functionality
[Image Removed]