在我的遊戲中,我有一個pacman風格的舞臺。邊緣碰撞器放置在每條線上。 現在,對於我的播放器的移動(WASD樣式),我最初使用了transform.Translate。這給了我希望我的球員擁有的最佳流暢動作。你們大多數人都知道,這使得邊緣對撞機無效,因爲玩家只會將其位置轉移到邊緣。爲了解決這個問題,我使用了rb.AddForce(new Vector2(Input.GetAxis(「Horizontal」)* speed,Input.GetAxis(「Vertical」)* speed);相反,我真的不喜歡玩家如何移動,因爲即使你放開WSAD鍵,它仍然會移動,並且它會發出更多的加速移動而不是計算的移動。運動問題
有沒有人知道解決此問題的方法?流體WASD運動(如transform.Translate)不通過邊對撞機。
我很感激!
參見[這](https://stackoverflow.com/questions/42537362/stop-character - 立即 - 當鍵被釋放/ 42537458#42537458)和[this](https://stackoverflow.com/questions/43166587/stop-object-instantly-after-collison/43167072#43167072)。它們都描述瞭如何在釋放鍵時停止對象。不,你不應該用'transform.Translate'移動剛體。 AddForce或移動功能是好的。 – Programmer