<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## **Rigidbody2D 二維剛體** Namespace: UnityEngine / Inherits from: Component ### Description 描述 用于2D精靈的剛體物理組件。 Rigidbody2D類本質上提供了與3D剛體同樣功能。添加Rigidbody2D組件到一個精靈上置于物理引擎的控制下。就其本身而言,這意味著精靈會受到重力的影響并可以從腳本使用力控制。通過添加合適的碰撞器組件,該精靈也會響應與其他精靈碰撞。這種行為完全來自Unity的物理系統;非常少的代碼得到令人印象深刻和真實的物理行為,并允許游戲中未明確編碼的“突發”的運動。 其他參考: Rigidbody class, SpriteRenderer class, Collider2D class, Joint2D class. ## **Variables 變量** **angularDrag** 角阻力系數。 **angularVelocity** 每秒度的角速度。 **attachedColliderCount (新)** 返回附加到該Bigidbody2D的Collider2D的數量。 **bodyType(新)** Bigidbody2D的物理行為類型。 **centerOfMass** 剛體局部空間坐標的質量中心。 **collisionDetectionMode** 這個方法用于檢測物理引擎兩個對象是否已經碰撞。 **constraints** 控制允許該Rigidbody2D模擬的自由度。 **drag** 阻力系數 。 **freezeRotation** 控制該對象的物理是否更改旋轉。 **gravityScale** 該對象將受重力影響。 **inertia** 該剛體旋轉的慣性。 **interpolation** 用于更新期間的物理插值。 **isKinematic** 這個剛體不采用物理控制么? **mass** 該剛體的質量。 **position** 該剛體的位置。 **rotation** 該剛體的旋轉角度。 **simulated** 標識該剛體是否應該物理模擬或不使用物理系統。 **sleepMode** 該休眠狀態就是該剛體將初始化狀態。 **useAutoMass** 該剛體的總質量是否從Collider2D.density自動計算。 **velocity** 該剛體的線性速度。 **useFullkinematicContacts(新)** 是否允許運動/運動和運動/靜態碰撞? **worldCenterOfMass** 在世界坐標空間獲取該剛體的質量中心。 ## **Functions 函數** **AddForce** 應用一個力到剛體。 **AddForceAtPosition ** 在給定位置添加力。 **AddRelativeForce** 添加一個力到二維剛體,相對于它的坐標系統。 **AddTorque** 在該剛體的質心應用一個力矩。 **GetPoint** Get a local space point given the point point in rigidBody global space. 在剛體世界坐標空間(全局空間)給定的點,獲得局部坐標空間的點。 **GetPointVelocity** 點/Point/ (全局空間)處剛體的速度。 **GetRelativePoint** 在剛體局部空間給定點relativePoint,獲得一個全局空間的點。 **GetRelativePointVelocity** The velocity of the rigidbody at the point Point in local space. 在局部空間剛體在point點的速度。 **GetRelativeVector** 在剛體局部坐標空間獲得給定向量relativeVector的全局坐標空間向量。 **GetVector** 在剛體全局空間給定的的vector向量的獲得局部空間向量。 **IsAwake** Sleeping是用來優化當一個對象在靜止時暫時刪除物理模擬。這個函數告訴當前剛體是否蘇醒。 **IsSleeping** 該剛體是否休眠? **IsTouching** 檢測附加到該剛體的任意碰撞器是否與collider接觸。 **IsTouchingLayers** 檢測附加到該剛體的任意碰撞器是否與指定層的碰撞器接觸。 **MovePosition** 移動剛體到position。 **MoveRotation** 旋轉該剛體到“angle”。 **Sleep** 使剛體休眠。 **WakeUp** 禁用一個剛體的休眠狀態。 ``` using UnityEngine; /// <summary> /// /// </summary> public class AddForce2 : MonoBehaviour { public float x_power=0.0f; public float y_power = 100.0f; public Rigidbody2D rb2d; private void Start() { rb2d=GetComponent<Rigidbody2D>(); } void FixedUpdate() { if (Input.GetMouseButton(0)) { Vector2 x_force = new Vector2(x_power,y_power); rb2d.AddForce(x_force); } } } ``` 由于AddForce只接受向量而不像3d的可以接受x y z 三個參數,所以我們改造下
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看