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

pause the whole simulation for simpause, add simpause to cv mode #2282

Closed
wants to merge 1 commit into from
Closed

pause the whole simulation for simpause, add simpause to cv mode #2282

wants to merge 1 commit into from

Conversation

Amigoshan
Copy link

The simPause API only paused the physical engine of the vehicle, and does not support CV mode. This pull request modifies the simPause function with UGameplayStatics::SetGlobalTimeDilation, which pause the entire simulation of the Unreal Engine. Also added simPause API for the CV mode.
Related issues:
#1309
#1494

@msftclas
Copy link

msftclas commented Oct 30, 2019

CLA assistant check
All CLA requirements met.

@madratman
Copy link
Contributor

cc #2256

@madratman
Copy link
Contributor

with this PR, on hitting sim Pause, I see a warning in the unreal console:

[2019.11.04-18.52.25:101][434]LogBlueprintUserMessages: Warning: Time Dilation must be between 0.000100 and 20.000000.  Clamped value to that range.

this hints that the game is not actually paused, but it's going on really slow at 1e-4 rate.

Googling this a bit yields https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/7217-slowmo-and-game-pause-via-blueprints-tutorial
quoting a relevant snippet from the above article:


Prepare the same set up as you did for the slow motion but replace the event with the one associated with your pause button. Change the time dilation in the node A to 0, compile and run the map. Unfortunately, when you hit the pause button, you can still see the ball moving. So, what's happened? Well, "Set Global Time Dilation" node cannot set Time Dilation to 0 as it will break some internal logic and will cause many other issues. When you set it to 0, it will automatically defaulted to a very small but non-zero number. In order to truly pause the game, we will need a "Set Game Paused" node (Call Function->Game->Set Game Paused). Replace our "Set Global Time Dilation" nodes with the "Set Game Paused" nodes and put the tick in the box of the one connected to the output "A" of the flip flop connected to the "Pause" event.

which finally yields the right API we should use SetGamePaused/: https://docs.unrealengine.com/en-US/API/Runtime/Engine/Kismet/UGameplayStatics/SetGamePaused/index.html

@madratman
Copy link
Contributor

I'll make a new PR for this

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.

3 participants