Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Character Plugin
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
Character Plugin
Commits
be4a0be3
Commit
be4a0be3
authored
Feb 7, 2023
by
Till Sittart
Browse files
Options
Downloads
Patches
Plain Diff
Fixing bugs
parent
b033c3b9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/CharacterPlugin/Private/VHSimpleMovement.cpp
+27
-2
27 additions, 2 deletions
Source/CharacterPlugin/Private/VHSimpleMovement.cpp
Source/CharacterPlugin/Private/VirtualHuman.cpp
+1
-1
1 addition, 1 deletion
Source/CharacterPlugin/Private/VirtualHuman.cpp
with
28 additions
and
3 deletions
Source/CharacterPlugin/Private/VHSimpleMovement.cpp
+
27
−
2
View file @
be4a0be3
...
...
@@ -706,8 +706,27 @@ void UVHSimpleMovement::TickComponent(float DeltaTime, ELevelTick TickType,
if
(
HitAgents
.
Num
())
{
int
i
=
1
;
int
iFront
=
0
;
int
iBack
=
0
;
TMap
<
AVirtualHuman
*
,
float
>
CurrentRiverChildAgents
;
// get list of all current childs that are walking in river formation
for
(
TPair
<
AVirtualHuman
*
,
float
>
Pair
:
ChildAgents
)
{
UVHSimpleMovement
*
ChildMovement
=
Pair
.
Key
->
FindComponentByClass
<
UVHSimpleMovement
>
();
if
(
ChildMovement
&&
ChildMovement
->
CurrentMovementFormation
==
SimpleRiver
)
{
CurrentRiverChildAgents
.
Add
(
Pair
.
Key
,
ChildMovement
->
CurrentOffset
);
}
}
TArray
<
float
>
CurrentRiverChildOffsets
;
CurrentRiverChildAgents
.
GenerateValueArray
(
CurrentRiverChildOffsets
);
float
MaxOffset
;
int
MaxIndex
;
UKismetMathLibrary
::
MaxOfFloatArray
(
CurrentRiverChildOffsets
,
MaxIndex
,
MaxOffset
);
for
(
TPair
<
AVirtualHuman
*
,
float
>
Pair
:
ChildAgents
)
{
...
...
@@ -721,6 +740,12 @@ void UVHSimpleMovement::TickComponent(float DeltaTime, ELevelTick TickType,
{
float
NewOffset
=
FMath
::
Abs
(
ChildMovement
->
ChildToParentOffset
)
*
-
1.f
*
1.1f
*
float
(
i
);
if
(
CurrentRiverChildOffsets
.
Contains
(
NewOffset
))
{
i
=
CurrentRiverChildOffsets
.
Num
()
+
1
;
NewOffset
=
FMath
::
Abs
(
ChildMovement
->
ChildToParentOffset
)
*
-
1.f
*
1.1f
*
float
(
i
);
}
// check if child is in front or behind pawn
ChildMovement
->
CurrentOffset
=
NewOffset
;
//VH_LOG("(Moving correction) Change child %s movement formation to SimpleRiver with offset %f", *HitChild->GetName(), NewOffset)
...
...
This diff is collapsed.
Click to expand it.
Source/CharacterPlugin/Private/VirtualHuman.cpp
+
1
−
1
View file @
be4a0be3
...
...
@@ -38,7 +38,7 @@ AVirtualHuman::AVirtualHuman()
PawnCollisionSphere
=
CreateDefaultSubobject
<
USphereComponent
>
(
TEXT
(
"PawnCollisionSphere"
));
PawnCollisionSphere
->
InitSphereRadius
(
150
);
PawnCollisionSphere
->
SetupAttachment
(
RootComponent
);
PawnCollisionSphere
->
SetRelativeLocation
(
FVector
(
2
7
0.f
,
0.f
,
10.f
));
PawnCollisionSphere
->
SetRelativeLocation
(
FVector
(
2
0
0.f
,
0.f
,
10.f
));
PawnCollisionSphere
->
SetRelativeScale3D
(
FVector
(
1.8f
,
0.4f
,
1.f
));
PawnCollisionSphere
->
SetGenerateOverlapEvents
(
true
);
PawnCollisionSphere
->
SetCollisionResponseToAllChannels
(
ECollisionResponse
::
ECR_Overlap
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment