Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DynamicPawn deceleration #1390

Merged
merged 10 commits into from
May 31, 2024
Merged

Add DynamicPawn deceleration #1390

merged 10 commits into from
May 31, 2024

Conversation

csciguy8
Copy link
Contributor

@csciguy8 csciguy8 commented Apr 5, 2024

This PR changes the dynamic camera to smoothly decelerate and come to a stop once you've stopped giving player input. This is a nicety that lets the camera feel like it has some mass as it moves around the world.

Start any level and navigate with the keyboard and mouse and you'll immediately notice it.

Feedback welcome. Getting the feel just right may take some iterations.

Blueprint changes...

Set deceleration based on speed
image

Simplified use of Speed Line Trace node
This block previously only allowed the pawn's speed to increase except in certain cases. I removed this limitation because it was causing a bug with deceleration when flying straight towards the ground. It would seem to fall and slide much faster than expected. In this case we need the speed to be updated continuously. I'm not exactly sure why it was needed. To smooth speed changes when flying over buildings maybe?
image

Simplified internal implementation of Speed Line Trace
Related to before, this node previously used "Dynamic Speed Min Height" to determine whether to override height. Not seeing why we need this anymore. We always use height as speed, and now we always update speed. Removing the related logic simplified the internals quite a bit.
image

Added internal speed scaling factor to tweak default feel
I always thought the default speed felt a little sluggish. This param lets us tweak it independent of user speed scaling
image

@csciguy8 csciguy8 changed the base branch from main to smooth-dynamicpawn-speed-changes April 5, 2024 22:07
Let `MovedThisFrame` var take into account movement input vector, in addition to camera location changes.
@csciguy8 csciguy8 changed the title Add dynamic pawn deceleration Add DynamicPawn deceleration Apr 5, 2024
@csciguy8 csciguy8 requested a review from j9liu April 25, 2024 16:51
Base automatically changed from smooth-dynamicpawn-speed-changes to main May 10, 2024 17:44
@csciguy8
Copy link
Contributor Author

@j9liu Hold on before reviewing this, need to merge.

Add back in deceleration block. Fix path of speed line trace node where trace distance wasn't getting set
@csciguy8
Copy link
Contributor Author

Ok @j9liu , this is ready for a look now.

Adding deceleration sounds easy enough, but it led to more changes than I anticipated. I've screen captured all the changes in the description, with explanations.

Open to any thoughts on the changes. It's hard to know the history of some of the logic that exists.

@csciguy8 csciguy8 requested review from azrogers and removed request for j9liu May 28, 2024 20:27
@kring kring added this to the June 2024 Release milestone May 30, 2024
@azrogers
Copy link
Contributor

Looks good to me! Made a few small formatting changes in the blueprint. This shouldn't have any effect on the build but I'll let the checks complete before I merge this one.

@azrogers azrogers merged commit 28dbfa2 into main May 31, 2024
19 checks passed
@azrogers azrogers deleted the add-dynamic-pawn-deceleration branch May 31, 2024 19:45
@csciguy8
Copy link
Contributor Author

csciguy8 commented May 31, 2024

Hey @azrogers , thanks for the review.

I noticed that you made some misc formatting changes, and now I'm no longer able to open the dynamic pawn blueprint in UE 5.2.

Did you happen to save this asset in a later version? (because we need to keep support for older versions, all the way to UE 5.2.)

@kring
Copy link
Member

kring commented Jun 3, 2024

I reverted the "minor formatting changes" commit in b04a389 to restore UE 5.2 compatibility. @azrogers please open a new PR with these changes, made with the correct UE version.

@j9liu
Copy link
Contributor

j9liu commented Jun 3, 2024

I'm really late to this, but I'm not a fan of the deceleration at much higher speeds. I'm not opposed to deceleration entirely, but I think it needs to scale better with the velocity of the camera. When you're flying around at high speeds, it takes a long time to slow down so you can really overshoot your target.

It's really hard to capture this in a gif, but basically I'm just flying at around this height above the earth.

image

I can increase my speed with the scroll wheel, and when I try to stop I sometimes end up bouncing off the terrain because the camera hit it, because it was too fast. In fact... when I'm not accidentally headbutting the Earth, I end up underground again 🙃

too fast

@csciguy8 I hate to say this, but I would really like to revert this change and test it further before we release it. The DynamicPawn is our sole example of movement across the globe, and I don't think it reflects well if a user can't traverse the globe faster without ending up underground, or bouncing off of the Earth. Please let me know ASAP if that's fine with you. Definitely feel free to remake this PR for future discussion / testing but I just don't agree with shipping the plugin with the camera as it exists now.

j9liu added a commit that referenced this pull request Jun 3, 2024
…eration"

This reverts commit 28dbfa2, which
introduced undesired behavior when flying at high speeds with the
dynamic pawn.
j9liu added a commit that referenced this pull request Jun 3, 2024
…eration"

This reverts commit 28dbfa2, which introduced undesired behavior when flying at high speeds with the
dynamic pawn.
j9liu added a commit that referenced this pull request Jun 3, 2024
…eration"

This reverts commit 28dbfa2, which introduced undesired behavior when flying at high speeds with the
dynamic pawn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants