Skip to content

Commit 981e326

Browse files
committed
fix links, RandomChance remove "value from BB" temporary
1 parent 870d89d commit 981e326

15 files changed

+22
-16
lines changed
1.73 KB
Binary file not shown.

Content/AI/BT_UHL_InAngle.uasset

2.49 KB
Binary file not shown.

Content/AI/BT_UHL_InRange.uasset

1.61 KB
Binary file not shown.
1.07 KB
Binary file not shown.
856 Bytes
Binary file not shown.

Content/AI/BT_UHL_RandomChance.uasset

1.22 KB
Binary file not shown.

Content/AI/BT_UHL_RandomLoop.uasset

1.75 KB
Binary file not shown.
1.35 KB
Binary file not shown.
1.46 KB
Binary file not shown.

Content/AI/BT_UHL_SetBBValue.uasset

24.7 KB
Binary file not shown.

Content/Gyms/Gym_AI.umap

170 Bytes
Binary file not shown.

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ From source:
2727
> - Components
2828
> - [AbilitySystemComponent](#abilitysystemcomponent)
2929
> - Tasks
30-
> - [InterpolateToPosition](interpolatetoposition)
30+
> - [InterpolateToPosition](#interpolatetoposition)
3131
> - [AI](#ai)
3232
> - Components
3333
> - [AIPerceptionComponent](#uhlaiperceptioncomponent)
@@ -181,10 +181,12 @@ Requirements:
181181

182182
- turn on `UseControllerDesiredRotation`
183183
- turn off
184+
- `bOrientRotationToMovement`
184185
- `UseControllerRotationYaw`
185186
- `UseControllerRotationPitch`
186187
- `UseControllerRotationRoll`
187188

189+
188190
Troubleshooting:
189191

190192
- check that nothing "ClearFocus"

Source/UnrealHelperLibrary/Private/AI/Decorators/BTD_InRange.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ float UBTD_InRange::GetCurrentDistance(const UBehaviorTreeComponent& OwnerComp,
104104
DrawDebugLine(OwnerComp.GetWorld(), LineStart, LineEnd, bInRange ? FColor::Green : FColor::Red, false, DebugLifetime, -1, 2.0f);
105105
DrawDebugSphere(OwnerComp.GetWorld(), LineStart, 5.0f, 16, FColor::Blue, false, DebugLifetime, DebugLifetime, 2.0f);
106106
DrawDebugSphere(OwnerComp.GetWorld(), LineEnd, 5.0f, 16, FColor::Blue, false, DebugLifetime, DebugLifetime, 2.0f);
107-
DrawDebugString(OwnerComp.GetWorld(), TextLocation, FString::Printf(TEXT("Distance: %.2f"), CurrentDistance), nullptr, FColor::White, DebugLifetime < 0 ? 0 : DebugLifetime, true);
107+
DrawDebugString(OwnerComp.GetWorld(), TextLocation, FString::Printf(TEXT("Distance: %.2f"), CurrentDistance), nullptr, bInRange ? FColor::Green : FColor::Red, DebugLifetime < 0 ? 0 : DebugLifetime, true);
108108
DrawDebugString(OwnerComp.GetWorld(), OwnerCharacter->GetActorLocation(), FString::Printf(TEXT("ParentNode:\n%s \n\nNodeName:\n%s"), *GetParentNode()->NodeName, *GetMyNode()->NodeName), nullptr, FColor::White, DebugLifetime < 0 ? 0 : DebugLifetime, true);
109109
}
110110

Source/UnrealHelperLibrary/Private/AI/Decorators/BTD_RandomChance.cpp

+12-10
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,34 @@ UBTD_RandomChance::UBTD_RandomChance(const FObjectInitializer& ObjectInitializer
1414
bAllowAbortLowerPri = false;
1515
bAllowAbortChildNodes = false;
1616

17-
ChanceInBB.AddFloatFilter(this, GET_MEMBER_NAME_CHECKED(UBTD_RandomChance, ChanceInBB));
17+
// TODO value from blackboard
18+
// ChanceInBB.AddFloatFilter(this, GET_MEMBER_NAME_CHECKED(UBTD_RandomChance, ChanceInBB));
1819
}
1920

2021
bool UBTD_RandomChance::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
2122
{
2223
float CurrentChance = 0.0f;
23-
if (bUseBlackboardValue)
24-
{
25-
CurrentChance = FMath::Clamp(OwnerComp.GetBlackboardComponent()->GetValueAsFloat(ChanceInBB.SelectedKeyName), 0.0f, 1.0f);
26-
}
24+
// TODO value from blackboard
25+
// if (bUseBlackboardValue)
26+
// {
27+
// CurrentChance = FMath::Clamp(OwnerComp.GetBlackboardComponent()->GetValueAsFloat(ChanceInBB.SelectedKeyName), 0.0f, 1.0f);
28+
// }
2729
// else if (bUseUnclamped)
2830
// {
2931
// CurrentChance = ChanceUnclamped
3032
// }
31-
else
32-
{
33+
// else
34+
// {
3335
CurrentChance = Chance;
34-
}
36+
// }
3537

3638
return UKismetMathLibrary::RandomBoolWithWeight(CurrentChance);
3739
}
3840

3941
FString UBTD_RandomChance::GetStaticDescription() const
4042
{
41-
// TODO BB value preview?
42-
// float CurrentChance = bUseBlackboardValue ? GetBlackboardAsset()->GetKey(ChanceInBB.GetSelectedKeyID()) : Chance;
43+
// TODO BB value preview?
44+
// float CurrentChance = bUseBlackboardValue ? GetBlackboardAsset()->GetKey(ChanceInBB.GetSelectedKeyID()) : Chance;
4345
return FString::Printf(TEXT("Chance - %.2f%% (%.2f)"), Chance * 100.0f, Chance);
4446
}
4547

Source/UnrealHelperLibrary/Public/AI/Decorators/BTD_RandomChance.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ class UNREALHELPERLIBRARY_API UBTD_RandomChance : public UBTDecorator
2121
float Chance;
2222
// UPROPERTY(Category=Decorator, EditAnywhere, meta=(EditCondition="bUseUnclamped && !bUseBlackboardValue", EditConditionHides))
2323
// float ChanceUnclamped;
24-
UPROPERTY(Category=Decorator, EditAnywhere, meta=(EditCondition="bUseBlackboardValue", EditConditionHides))
25-
FBlackboardKeySelector ChanceInBB;
24+
// TODO value from blackboard
25+
// UPROPERTY(Category=Decorator, EditAnywhere, meta=(EditCondition="bUseBlackboardValue", EditConditionHides))
26+
// FBlackboardKeySelector ChanceInBB;
2627

2728
// UPROPERTY(Category=Decorator, EditAnywhere)
2829
// bool bUseUnclamped = false;
29-
UPROPERTY(Category=Decorator, EditAnywhere)
30-
bool bUseBlackboardValue = false;
30+
// TODO value from blackboard
31+
// UPROPERTY(Category=Decorator, EditAnywhere)
32+
// bool bUseBlackboardValue = false;
3133

3234
virtual bool CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const override;
3335

0 commit comments

Comments
 (0)