【问题标题】:how can i set the direction of bullet towards enemy?如何设置子弹朝向敌人的方向?
【发布时间】:2017-10-07 15:07:03
【问题描述】:

我想向敌人射击。
但我无法正确设置子弹的方向。
我该如何设置?
这是我的代码。

    GameObject gm = (GameObject)Instantiate(BulletPrefab, BulletPoint.position, BulletPoint.rotation);

ScreenShot

【问题讨论】:

  • 看看Quaternion.LookRotation()

标签: c# unity3d


【解决方案1】:

tnx,伙计们。问题解决了。
我只是创建一个空的游戏对象并通过调整空的游戏对象来修复枢轴。

        GameObject monster = (GameObject)Instantiate(Resources.Load("Bullet"));
    monster.transform.position = BulletPoint.transform.position;
    monster.transform.rotation = BulletPoint.transform.rotation;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-19
    • 1970-01-01
    • 2021-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多