我希望物体在生成时转向并朝我的敌方物体移动。我已经完成了旅行,但向敌人的旋转似乎不起作用。
这是我当前的代码:
GameObject newRocket = GameObject.FindGameObjectWithTag("Enemy");
direction = (cil.transform.position - novaStrela.transform.position);
rotationDirection = Quaternion.LookRotation(direction);
newRocket = Instantiate (rocket, transform.position, rotationDirection) as GameObject;
newRocket.rigidbody.AddForce ((target.transform.position - transform.position).normalized * projectileSpeed);
我知道这有点乱,但如果你能帮助我,我会很高兴的。谢谢你到目前为止