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
ca7be93a
Commit
ca7be93a
authored
Jun 28, 2024
by
Jonathan Ehret
Browse files
Options
Downloads
Patches
Plain Diff
use a constantly seeded random stream for idle movements, for cluster-robustness.
parent
640e9e7a
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/VirtualHuman.cpp
+5
-1
5 additions, 1 deletion
Source/CharacterPlugin/Private/VirtualHuman.cpp
Source/CharacterPlugin/Public/VirtualHuman.h
+1
-0
1 addition, 0 deletions
Source/CharacterPlugin/Public/VirtualHuman.h
with
6 additions
and
1 deletion
Source/CharacterPlugin/Private/VirtualHuman.cpp
+
5
−
1
View file @
ca7be93a
...
...
@@ -37,6 +37,10 @@ void AVirtualHuman::BeginPlay()
SetUpBodyType
();
bFirstTick
=
true
;
// constantly seed the random stream so we don't have cluster syncing problems
// but seed it with the name of the VH, so random behavior is different for every VH
IdleRandomStream
=
FRandomStream
(
TextKeyUtil
::
HashString
(
*
GetOwner
()
->
GetName
()));
}
// Called every frame
...
...
@@ -292,7 +296,7 @@ void AVirtualHuman::PlayRandomIdleAnimation()
}
// play arandom idle animation
int
Random
=
FMath
::
RandRange
(
0
,
CustomIdleAnimations
.
Num
()
-
1
);
int
Random
=
IdleRandomStream
.
RandRange
(
0
,
CustomIdleAnimations
.
Num
()
-
1
);
UAnimSequence
*
IdleAnim
=
CustomIdleAnimations
[
Random
];
if
(
IdleAnim
)
{
...
...
This diff is collapsed.
Click to expand it.
Source/CharacterPlugin/Public/VirtualHuman.h
+
1
−
0
View file @
ca7be93a
...
...
@@ -135,6 +135,7 @@ private:
void
PlayRandomIdleAnimation
();
UPROPERTY
()
FTimerHandle
NextIdleTimerHandle
;
FRandomStream
IdleRandomStream
;
#if WITH_EDITOR
virtual
void
PostEditChangeProperty
(
FPropertyChangedEvent
&
PropertyChangedEvent
)
override
;
...
...
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