英文:
Player Rigidbody2D not adding force(unity)
问题
In the "continue9" function, when using the player's Rigidbody in the last case (case 24), it doesn't add any force to the player.
在"continue9"函数中,在最后一个情况(case 24)中,当使用玩家的Rigidbody时,它不会给玩家添加任何力。
英文:
public void Continue9()
{
player.dialouge1 = false;
dialogue = true;
index += 1;
switch (index)
{
case 21:
conversation3.SetActive(true);
text3.text = "No... Not farewell";
image3.sprite = mirage;
break;
case 22:
text3.text = "Whatcha gonna do now...";
image3.sprite = scourge;
break;
case 23:
text3.text = "TRANSFORM!!!";
image3.sprite = mirage;
break;
case 24:
rb.AddForce(Vector2.left * speed1, ForceMode2D.Impulse);
conversation3.SetActive(false);
player.Transforming();
break;
}
}
In this continue9 function in the last case 24, when I am using the players rigidbody(that has been assigned and is 2D) it doesn't add any sort of force to the player.
答案1
得分: 1
有很多可能性。
- 刚体是运动学的。
- 该函数从未被调用。
- 力的值不足。
- 刚体上应用了运动约束。
- rb 为空。
英文:
There can be so many possibilities.
- The Rigidbody is Kinematic.
- The function is never called.
- The force value is not enough.
- Movement Constraints are applied on the Rigidbody.
- rb is null
You will have to debug it one by one. This guide to Unity Rigidbody may be helpful.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论