在鼠标点击的位置上出现特效(气泡)
if (Input.GetMouseButtonDown(0))
{
// 泡泡预设出来的原始位置
Vector3 bubblePos = new Vector3(8.95f, 1.04f, -0.76f);
GameObject bubble = Instantiate(clickBubble, bubblePos, Quaternion.identity) as GameObject;
Vector3 screenPos = Camera.main.WorldToScreenPoint(bubble.transform.position);
【在鼠标点击的位置上出现特效(气泡)】Vector3 curScreenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPos.z);
Vector3 curPos = Camera.main.ScreenToWorldPoint(curScreenPos);
// print(CurPosition);
bubble.transform.position = curPos;
Destroy(bubble, 2f);
}
文章图片