【发布时间】:2017-08-23 13:48:29
【问题描述】:
我有一个问题。屏幕上有 4 个物体和一个弹丸,如下图所示。 image source
当我点击 4 弹丸中的一个对象时,它会改变位置,指示我点击的对象。 这是使用的代码,但它不起作用。
public GameObject Tun;
public GameObject[] robotColliders;
public GameObject[] Robots;
foreach(GameObject coll in robotColliders)
{
coll.GetOrAddComponent<MouseEventSystem>().MouseEvent += SetGeometricFigure;
}
private void SetGeometricFigure(GameObject target, MouseEventType type)
{
if(type == MouseEventType.CLICK)
{
Debug.Log("Clicked");
int targetIndex = System.Array.IndexOf(robotColliders, target);
Tun.transform.DORotate(Robots[targetIndex].transform.position, 2f, RotateMode.FastBeyond360).SetEase(Ease.Linear);
}
}
我正在考虑使用组件 DORotate(),但它无论如何都不起作用。有谁知道如何解决这个问题?
【问题讨论】:
标签: c# unity3d rotation dotween