This is a function i use;

tPoint is

type tPoint

float x

float y

float z

endtype

If you want the position within the sprite then use

GetSpritePixelFromX(sprite, GetPointerX())

GetSpritePixelFromY(sprite, GetPointerY())

function GetObjectContactPoint(obj as integer, pos ref as tPoint)
f as tPoint
t as tPoint
w as tPoint
dot as float
r as integer
id as integer
f.x = Get3DVectorXFromScreen( GetPointerX(), GetPointerY() )
f.y = Get3DVectorYFromScreen( GetPointerX(), GetPointerY() )
f.z = Get3DVectorZFromScreen( GetPointerX(), GetPointerY() )
// get a vector that points in the direction the camera is looking
t.x = Get3DVectorXFromScreen( GetVirtualWidth()/2.0, GetVirtualHeight()/2.0 )
t.y = Get3DVectorYFromScreen( GetVirtualWidth()/2.0, GetVirtualHeight()/2.0 )
t.z = Get3DVectorZFromScreen( GetVirtualWidth()/2.0, GetVirtualHeight()/2.0 )
// normalise Vector in the direction of Vector2
dot = f.x*t.x + f.y*t.y + f.z*t.z
if ( dot > 0 )
f.x = f.x / dot
f.y = f.y / dot
f.z = f.z / dot
endif
w.x = f.x * 0x7FFFFFFF + GetCameraX(1)
w.y = f.y * 0x7FFFFFFF + GetCameraY(1)
w.z = f.z * 0x7FFFFFFF + GetCameraZ(1)
ObjectRayCast(obj, GetcameraX(1), GetcameraY(1), GetcameraZ(1), w.x, w.y, w.z)
if GetObjectRayCastNumHits() and GetObjectRayCastHitID(0)
r = 1
pos.x = GetObjectRayCastX(0)
pos.y = GetObjectRayCastY(0)
pos.z = GetObjectRayCastZ(0)
else
r = 0
endif
endfunction r