So, I have a 3d object, and I am trying to get the x,y,z position when I click anywhere within the 3d object, but I have no idea how.
For example, if I were to click in the middle of the 3d object, it will give me coordinates (0,50,0). and if I click on the top left, it will say (0,0,0).
EDIT: I want to get the coordinate when I click anywhere on my 3d object relative to the object pivot point
you can do the following (assuming your object has a
MeshColliderattached - or any otherColliderbut of course you will get the point on the collider not the mesh itself)See
Camera.mainCamera.ScreenPointToRayPhysics.RaycastRaycastHit.pointTransform.InverseTransformPoint