Skip to content

Commit

Permalink
Fixed head rotation (animbp) and distance calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kvoeten committed Mar 11, 2021
1 parent 6913f10 commit 87675d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Binary file modified Content/Blueprints/ABP_IKBody.uasset
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void UIKCharacterAnimInstance::TraceFoot(FVector Foot, FVector* ResultLocation,

void UIKCharacterAnimInstance::UpdateHeadValues()
{
//Simply set head values to match camera at all times.
// Simply set head values to match camera at all times.
HeadIKValues.HeadRotation = this->BodyComponent->Camera->GetComponentRotation();
HeadIKValues.HeadLocation = this->BodyComponent->Camera->GetComponentLocation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ void UIKBodyComponent::TickBodyMovement(float DeltaTime)

// Calculate the XY distance moved
float DistanceMoved = FVector::Distance(
FVector(CameraCurrentPosition.GetLocation().X, CameraCurrentPosition.GetLocation().X, 0),
FVector(LastCameraPosition.GetLocation().X, LastCameraPosition.GetLocation().X, 0)
FVector(CameraCurrentPosition.GetLocation().X, CameraCurrentPosition.GetLocation().Y, 0),
FVector(LastCameraPosition.GetLocation().X, LastCameraPosition.GetLocation().Y, 0)
);

// Calculate Yaw difference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class UNREALBODY_API UIKBodyComponent : public UActorComponent
UCameraComponent* Camera = nullptr;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "IKBody")
float MovementThreshold = 15.0f
float MovementThreshold = 60.0f
UMETA(Tooltip = "Amount of units a player's head has to move to consider it a step instead of head movement.");

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "IKBody")
float RotationThreshold = 15.0f
float RotationThreshold = 25.0f
UMETA(Tooltip = "Amount of degrees player's head has to turn to consider it more than just head movement.");

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "IKBody")
Expand Down

0 comments on commit 87675d9

Please sign in to comment.