I have a base plane and when I click on the plane I need to add some other object at the exact location the user is touched. the newly added object is not a child of base plane it will be a child of another object which will present the same base plane
I tried using raycast position but it didn't work well.
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);
Instead of raycastHit.transform.position
use raycastHit.point
- that should do the trick