问题描述
我有一个关于 Unity3d 物理的问题,了解解决它的方法对我来说很重要,因为这对我来说一直是个问题。我正在尝试制作“push'em all”手机游戏的克隆。我有一个玩家对象,它有一个刚体,上面有几个游戏对象。一个游戏对象“movingpusher”也有自己的刚体。现在,如果我的敌人触发玩家对象,他们会向前推动玩家,但是,我只是使用“AddForce”到玩家对象的刚体,结果就像附加的照片一样。 image of the scene
这是代码部分
private void Awake()
{
EnemyController.PushPlayer += Getdamage;
PlayerRigid = gameObject.GetComponent<Rigidbody>();
}
private void Getdamage()
{
Debug.Log("Takingdamage");
gettingdamage = true;
PlayerRigid.AddForce(StablePusher.forward * 50);
PlayerRigid.veLocity = transform.TransformDirection(0,5);
}
现在,我也为 MovingPusher 的刚体添加了 AddForce,但它们不会同时移动,首先玩家对象向前移动,然后移动推手移动。如果您能分享您的想法,我将不胜感激:)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)