Skip to content

Commit

Permalink
Merge pull request #69 from dyanikoglu/dev
Browse files Browse the repository at this point in the history
Release v4.7
  • Loading branch information
dyanikoglu authored Sep 26, 2020
2 parents a14c2bf + 054a868 commit 05a58cd
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion ALSV4_CPP.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "4.6",
"VersionName": "4.7",
"FriendlyName": "Advanced Locomotion System V4 on C++",
"Description": "Performance optimized C++ port of LongmireLocomotion's Advanced Locomotion System V4",
"Category": "Animation",
Expand Down
Binary file modified Content/AdvancedLocomotionV4/Blueprints/UI/ALS_HUD.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/AdvancedLocomotionV4/Levels/ALS_DemoLevel.umap
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/ALSV4_CPP/Private/Character/ALSBaseCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void AALSBaseCharacter::BeginPlay()

// Update states to use the initial desired values.
SetGait(DesiredGait);
SetDesiredStance(DesiredStance);
SetStance(DesiredStance);
SetRotationMode(DesiredRotationMode);
SetViewMode(ViewMode);
SetOverlayState(OverlayState);
Expand Down
15 changes: 9 additions & 6 deletions Source/ALSV4_CPP/Private/Character/ALSPlayerCameraManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "Character/ALSPlayerCameraManager.h"


#include "DrawDebugHelpers.h"
#include "Character/ALSBaseCharacter.h"
#include "Character/Animation/ALSPlayerCameraBehavior.h"
#include "Kismet/KismetMathLibrary.h"
Expand All @@ -31,6 +33,11 @@ void AALSPlayerCameraManager::OnPossess(AALSBaseCharacter* NewCharacter)
{
CastedBehv->PlayerController = GetOwningPlayerController();
CastedBehv->ControlledPawn = ControlledCharacter;

// Initial position
const FVector& TPSLoc = ControlledCharacter->GetThirdPersonPivotTarget().GetLocation();
SetActorLocation(TPSLoc);
SmoothedPivotTarget.SetLocation(TPSLoc);
}
}

Expand All @@ -54,16 +61,12 @@ void AALSPlayerCameraManager::UpdateViewTargetInternal(FTViewTarget& OutVT, floa
FRotator OutRotation;
float OutFOV;

if (OutVT.Target->ActorHasTag(CustomTag) && CustomCameraBehavior(DeltaTime, OutLocation, OutRotation, OutFOV))
if (CustomCameraBehavior(DeltaTime, OutLocation, OutRotation, OutFOV))
{
OutVT.POV.Location = OutLocation;
OutVT.POV.Rotation = OutRotation;
OutVT.POV.FOV = OutFOV;
}
else
{
OutVT.Target->CalcCamera(DeltaTime, OutVT.POV);
}
}
}

Expand Down Expand Up @@ -152,7 +155,7 @@ bool AALSPlayerCameraManager::CustomCameraBehavior(float DeltaTime, FVector& Loc

FHitResult HitResult;
World->SweepSingleByChannel(HitResult, TraceOrigin, TargetCameraLocation, FQuat::Identity,
TraceChannel, FCollisionShape::MakeSphere(TraceRadius), Params);
TraceChannel, FCollisionShape::MakeSphere(TraceRadius), Params);

if (HitResult.bBlockingHit)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ void UALSCharacterAnimInstance::NativeUpdateAnimation(float DeltaSeconds)

UpdateAimingValues(DeltaSeconds);
UpdateLayerValues();

UpdateFootIK(DeltaSeconds);

if (MovementState.Grounded())
{
UpdateFootIK(DeltaSeconds);

// Check If Moving Or Not & Enable Movement Animations if IsMoving and HasMovementInput, or if the Speed is greater than 150.
const bool prevShouldMove = Grounded.bShouldMove;
Grounded.bShouldMove = ShouldMoveCheck();
Expand Down Expand Up @@ -275,19 +274,17 @@ void UALSCharacterAnimInstance::UpdateFootIK(float DeltaSeconds)
else if (!MovementState.Ragdoll())
{
// Update all Foot Lock and Foot Offset values when not In Air
FVector FootOffsetLTarget;
FVector FootOffsetRTarget;
SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_L")), FName(TEXT("ik_foot_l")), FName(TEXT("Root")), FootOffsetLTarget,
SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_L")), FName(TEXT("ik_foot_l")), FName(TEXT("Root")), FootOffsetLTargetCached,
FootIKValues.FootOffset_L_Location, FootIKValues.FootOffset_L_Rotation);
SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_R")), FName(TEXT("ik_foot_r")), FName(TEXT("Root")), FootOffsetRTarget,
SetFootOffsets(DeltaSeconds, FName(TEXT("Enable_FootIK_R")), FName(TEXT("ik_foot_r")), FName(TEXT("Root")), FootOffsetRTargetCached,
FootIKValues.FootOffset_R_Location, FootIKValues.FootOffset_R_Rotation);
SetPelvisIKOffset(DeltaSeconds, FootOffsetLTarget, FootOffsetRTarget);
SetPelvisIKOffset(DeltaSeconds, FootOffsetLTargetCached, FootOffsetRTargetCached);
}
}

void UALSCharacterAnimInstance::SetFootLocking(float DeltaSeconds, FName EnableFootIKCurve, FName FootLockCurve,
FName IKFootBone, float& CurFootLockAlpha, bool& UseFootLockCurve,
FVector& CurFootLockLoc, FRotator& CurFootLockRot)
FVector& CurFootLockLoc, FRotator& CurFootLockRot)
{
if (GetCurveValue(EnableFootIKCurve) <= 0.0f)
{
Expand All @@ -299,8 +296,8 @@ void UALSCharacterAnimInstance::SetFootLocking(float DeltaSeconds, FName EnableF

if (UseFootLockCurve)
{
UseFootLockCurve = FMath::Abs(GetCurveValue(FName(TEXT("RotationAmount")))) <= 0.001f ||
Character->GetLocalRole() != ROLE_AutonomousProxy;
UseFootLockCurve = FMath::Abs(GetCurveValue(FName(TEXT("RotationAmount")))) <= 0.001f ||
Character->GetLocalRole() != ROLE_AutonomousProxy;
FootLockCurveVal = GetCurveValue(FootLockCurve);
}
else
Expand All @@ -315,7 +312,7 @@ void UALSCharacterAnimInstance::SetFootLocking(float DeltaSeconds, FName EnableF
{
CurFootLockAlpha = FootLockCurveVal;
}

// Step 3: If the Foot Lock curve equals 1, save the new lock location and rotation in component space as the target.
if (CurFootLockAlpha >= 0.99f)
{
Expand Down Expand Up @@ -777,8 +774,8 @@ void UALSCharacterAnimInstance::TurnInPlace(FRotator TargetRotation, float PlayR
if (FMath::Abs(TurnAngle) < TurnInPlaceValues.Turn180Threshold)
{
TargetTurnAsset = TurnAngle < 0.0f
? TurnInPlaceValues.N_TurnIP_L90
: TurnInPlaceValues.N_TurnIP_R90;
? TurnInPlaceValues.N_TurnIP_L90
: TurnInPlaceValues.N_TurnIP_R90;
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions Source/ALSV4_CPP/Public/Character/ALSPlayerCameraManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ class ALSV4_CPP_API AALSPlayerCameraManager : public APlayerCameraManager
USkeletalMeshComponent* CameraBehavior = nullptr;

protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FName CustomTag = FName(TEXT("ALS_Character"));

UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
FVector RootLocation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ class ALSV4_CPP_API UALSCharacterAnimInstance : public UAnimInstance
/** Foot IK */

void SetFootLocking(float DeltaSeconds, FName EnableFootIKCurve, FName FootLockCurve, FName IKFootBone,
float& CurFootLockAlpha, bool& UseFootLockCurve,
FVector& CurFootLockLoc, FRotator& CurFootLockRot);
float& CurFootLockAlpha, bool& UseFootLockCurve,
FVector& CurFootLockLoc, FRotator& CurFootLockRot);

void SetFootLockOffsets(float DeltaSeconds, FVector& LocalLoc, FRotator& LocalRot);

Expand Down Expand Up @@ -293,4 +293,7 @@ class ALSV4_CPP_API UALSCharacterAnimInstance : public UAnimInstance
FTimerHandle OnJumpedTimer;

bool bCanPlayDynamicTransition = true;

FVector FootOffsetLTargetCached;
FVector FootOffsetRTargetCached;
};

0 comments on commit 05a58cd

Please sign in to comment.