MCPcopy Create free account
hub / github.com/Sixze/ALS-Refactored / RefreshFeetOnGameThread

Method RefreshFeetOnGameThread

Source/ALS/Private/AlsAnimationInstance.cpp:1246–1296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1244}
1245
1246void UAlsAnimationInstance::RefreshFeetOnGameThread()
1247{
1248 check(IsInGameThread())
1249
1250 const auto* Mesh{GetSkelMeshComponent()};
1251 const auto PelvisTransform{Mesh->GetSocketTransform(UAlsConstants::PelvisBoneName(), RTS_Component)};
1252
1253 if (bPendingUpdate)
1254 {
1255 FeetState.bValid = false;
1256 FeetState.bBecameValid = false;
1257 }
1258 else if (!FeetState.bValid)
1259 {
1260 // USkinnedMeshComponent::GetSocketTransform() can return an invalid transform in some cases, so we need to check this.
1261 // Ideally, we should use USkinnedMeshComponent.::bHasValidBoneTransform here instead, but it can't be accessed.
1262 // TODO Wait for https://github.com/EpicGames/UnrealEngine/pull/14322 to be merged into the engine.
1263
1264 if (PelvisTransform.EqualsNoScale(FTransform::Identity))
1265 {
1266 return;
1267 }
1268
1269 FeetState.bValid = true;
1270 FeetState.bBecameValid = true;
1271 }
1272 else
1273 {
1274 FeetState.bBecameValid = false;
1275 }
1276
1277 FeetState.PelvisRotation = FQuat4f{PelvisTransform.GetRotation()};
1278
1279 const auto FootLeftTargetTransform{
1280 Mesh->GetSocketTransform(Settings->General.bUseFootIkBones
1281 ? UAlsConstants::FootLeftIkBoneName()
1282 : UAlsConstants::FootLeftVirtualBoneName())
1283 };
1284
1285 FeetState.Left.TargetLocationWorldSpace = FootLeftTargetTransform.GetLocation();
1286 FeetState.Left.TargetRotationWorldSpace = FootLeftTargetTransform.GetRotation();
1287
1288 const auto FootRightTargetTransform{
1289 Mesh->GetSocketTransform(Settings->General.bUseFootIkBones
1290 ? UAlsConstants::FootRightIkBoneName()
1291 : UAlsConstants::FootRightVirtualBoneName())
1292 };
1293
1294 FeetState.Right.TargetLocationWorldSpace = FootRightTargetTransform.GetLocation();
1295 FeetState.Right.TargetRotationWorldSpace = FootRightTargetTransform.GetRotation();
1296}
1297
1298void UAlsAnimationInstance::RefreshFeet(const float DeltaTime)
1299{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected