diff --git a/Content/Character/Mesh/UE4_Mannequin_Skeleton.uasset b/Content/Character/Mesh/UE4_Mannequin_Skeleton.uasset index 0c19298..5ae8621 100644 Binary files a/Content/Character/Mesh/UE4_Mannequin_Skeleton.uasset and b/Content/Character/Mesh/UE4_Mannequin_Skeleton.uasset differ diff --git a/Source/UnrealBody/Private/Animation/IKCharacterAnimInstance.cpp b/Source/UnrealBody/Private/Animation/IKCharacterAnimInstance.cpp index 1257f89..2685330 100644 --- a/Source/UnrealBody/Private/Animation/IKCharacterAnimInstance.cpp +++ b/Source/UnrealBody/Private/Animation/IKCharacterAnimInstance.cpp @@ -74,11 +74,6 @@ void UIKCharacterAnimInstance::UpdateFootIK() FCollisionQueryParams Params; Params.AddIgnoredActor(Character); - // Debug Draw - const FName TraceTag("FeetTraces"); - World->DebugDrawTraceTag = TraceTag; - Params.TraceTag = TraceTag; - // Trace both feet and set result in AnimGraph TraceFoot(LeftFoot, &FootIKValues.LeftFootLocation, &FootIKValues.LeftFootRotation, World, &Params); @@ -141,9 +136,16 @@ void UIKCharacterAnimInstance::UpdateHandValues() { USkeletalMeshComponent* OwnerComp = GetOwningComponent(); + // Get offsets + FTransform LeftOffset = OwnerComp->GetSocketTransform("hand_lSocket", ERelativeTransformSpace::RTS_ParentBoneSpace); + FTransform RightOffset = OwnerComp->GetSocketTransform("hand_rSocket", ERelativeTransformSpace::RTS_ParentBoneSpace); + + // Fix left offset + LeftOffset.ScaleTranslation(-1); + // Get controller transform * offset - ArmIKValues.LeftTargetTransform = this->BodyComponent->LeftController->GetComponentTransform(); - ArmIKValues.RightTargetTransform = this->BodyComponent->RightController->GetComponentTransform(); + ArmIKValues.LeftTargetTransform = this->BodyComponent->LeftController->GetComponentTransform() * LeftOffset; + ArmIKValues.RightTargetTransform = this->BodyComponent->RightController->GetComponentTransform() * RightOffset; } void UIKCharacterAnimInstance::UpdateMovementValues() diff --git a/Source/UnrealBody/Private/CharacterComponents/IKBodyComponent.cpp b/Source/UnrealBody/Private/CharacterComponents/IKBodyComponent.cpp index e3fd34e..e4c0928 100644 --- a/Source/UnrealBody/Private/CharacterComponents/IKBodyComponent.cpp +++ b/Source/UnrealBody/Private/CharacterComponents/IKBodyComponent.cpp @@ -131,7 +131,7 @@ void UIKBodyComponent::TickBodyMovement(float DeltaTime) else { // Tick towards location based on movement speed - this->BodyCurrentLocation = UKismetMathLibrary::VInterpTo(this->BodyCurrentLocation, this->BodyTargetLocation, DeltaTime, MovementSpeed); + this->BodyCurrentLocation = UKismetMathLibrary::VInterpTo(this->BodyCurrentLocation, this->BodyTargetLocation, DeltaTime, MovementSpeed * this->MovementSpeedMultiplier); this->Body->SetWorldLocation(BodyCurrentLocation); } diff --git a/Source/UnrealBody/Public/CharacterComponents/IKBodyComponent.h b/Source/UnrealBody/Public/CharacterComponents/IKBodyComponent.h index 8e00c42..2a84e39 100644 --- a/Source/UnrealBody/Public/CharacterComponents/IKBodyComponent.h +++ b/Source/UnrealBody/Public/CharacterComponents/IKBodyComponent.h @@ -53,7 +53,15 @@ class UNREALBODY_API UIKBodyComponent : public UActorComponent UCameraComponent* Camera = nullptr; /* - Movement Values, replicated (server changes are sent to clients) + * Non-Replicated Setting variables + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Settings") + float MovementSpeedMultiplier = 1.0f + UMETA(Tooltip = "Increase or decrease the speed of the character during movement. Use this to avoid the character lagging behind over longer distances."); + + + /* + * Movement Values, replicated (server changes are sent to clients) */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Replicated, Category = "IKBody") float MovementThreshold = 60.0f diff --git a/UnrealBody.uplugin b/UnrealBody.uplugin index 5badc21..4e8da4a 100644 --- a/UnrealBody.uplugin +++ b/UnrealBody.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "1.1", + "VersionName": "1.0.2", "FriendlyName": "Unreal Body Plugin", "Description": "Standalone plugin that provides an IK body, with finger collision, animated by 3 tracking points.", "Category": "VR",