Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
78f96e6f
Commit
78f96e6f
authored
7 years ago
by
andreykproductengine
Browse files
Options
Downloads
Patches
Plain Diff
MAINT-8190 Avatar Physics safety checks and better iteration spreading
parent
16438d22
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llphysicsmotion.cpp
+7
-9
7 additions, 9 deletions
indra/newview/llphysicsmotion.cpp
with
7 additions
and
9 deletions
indra/newview/llphysicsmotion.cpp
+
7
−
9
View file @
78f96e6f
...
...
@@ -44,7 +44,9 @@ typedef std::map<std::string, std::string> controller_map_t;
typedef
std
::
map
<
std
::
string
,
F32
>
default_controller_map_t
;
#define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f
#define TIME_ITERATION_STEP 0.05f
// we use TIME_ITERATION_STEP_MAX in division operation, make sure this is a simple
// value and devision result won't end with repeated/recurring tail like 1.333(3)
#define TIME_ITERATION_STEP_MAX 0.05f // minimal step size will end up as 0.025
inline
F64
llsgn
(
const
F64
a
)
{
...
...
@@ -480,7 +482,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
if
(
!
mParamDriver
)
return
FALSE
;
if
(
!
mLastTime
)
if
(
!
mLastTime
||
mLastTime
>=
time
)
{
mLastTime
=
time
;
return
FALSE
;
...
...
@@ -561,14 +563,10 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
// bounce at right (relatively) position.
// Note: this doesn't look to be optimal, since it provides only "roughly same" behavior, but
// irregularity at higher fps looks to be insignificant so it works good enough for low fps.
for
(
F32
time_iteration
=
0
;
time_iteration
<=
time_delta
;
time_iteration
+=
TIME_ITERATION_STEP
)
U32
steps
=
(
U32
)(
time_delta
/
TIME_ITERATION_STEP_MAX
)
+
1
;
F32
time_iteration_step
=
time_delta
/
(
F32
)
steps
;
//minimal step size ends up as 0.025
for
(
U32
i
=
0
;
i
<
steps
;
i
++
)
{
F32
time_iteration_step
=
TIME_ITERATION_STEP
;
if
(
time_iteration
+
TIME_ITERATION_STEP
>
time_delta
)
{
time_iteration_step
=
time_delta
-
time_iteration
;
}
// mPositon_local should be in normalized 0,1 range already. Just making sure...
const
F32
position_current_local
=
llclamp
(
mPosition_local
,
0.0
f
,
...
...
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