Created
May 4, 2018 10:39
-
-
Save tsubaki/e8a56037cca081fac8624457074d9a5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class PSim : MonoBehaviour { | |
[SerializeField][Range(1, 5)] float maxTime = 0.1f; | |
private void Awake() | |
{ | |
Physics.autoSimulation = false; | |
} | |
private void Start() | |
{ | |
float time = 0; | |
while(time < maxTime) | |
{ | |
Physics.Simulate(Time.fixedDeltaTime); | |
time += Time.fixedDeltaTime; | |
} | |
} | |
private void OnDestroy() | |
{ | |
Physics.autoSimulation = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment