如何获取对象的精确触摸位置以在同一位置添加新的子对象

How to get exact touch location of object to add new child object at the same place

我有一个基本平面,当我单击该平面时,我需要在用户触摸的确切位置添加一些其他对象。新添加的对象不是基平面的子对象,它将是另一个呈现相同基平面的对象的子对象

我尝试使用光线投射位置,但效果不佳。

Vector3 objLocation = new Vector3(raycastHit.transform.position.x, 180.0f, raycastHit.transform.position.z);
GameObject newObj = Instantiate(singleDustBin, objLocation, Quaternion.identity);                  newObj.transform.SetParent(dustBinPrefab.transform);

而不是 raycastHit.transform.position 使用 raycastHit.point - 应该可以解决问题