MonoBehaviour.FixedUpdate 固定更新
function?FixedUpdate?() : void
Description描述
This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
當MonoBehaviour啟用時,其?FixedUpdate?在每一幀被調用。
FixedUpdate should be used instead of Update when dealing with?Rigidbody?. For example when adding a force to a rigidbody, you have to apply the force every fixed frame inside FixedUpdate instead of every frame inside Update.
處理Rigidbody時,需要用FixedUpdate代替Update。例如:給剛體加一個作用力時,你必須應用作用力在FixedUpdate里的固定幀,而不是Update中的幀。(兩者幀長不同)
// Apply a upwards force to the rigid body every frame // 每幀應用一個向上的力到剛體上 function FixedUpdate () {rigidbody.AddForce ( Vector3.up ); }In order to get the elapsed time since last call to FixedUpdate, use?Time.deltaTime?This function is only called if the?Behaviour?is enabled. Override this function in order to provide your component's functionality.
為了獲取自最后一次調用FixedUpdate所用的時間,可以用Time.deltaTime。這個函數只有在Behaviour啟用時被調用。實現組件功能時重載這個函數。
轉載于:https://www.cnblogs.com/vincentDr/p/3681062.html
總結
以上是生活随笔為你收集整理的MonoBehaviour.FixedUpdate 固定更新的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ACMZOJ
- 下一篇: Android获取程序路径 (/data