Hello.
I have some issues with thePainterInterface. In some situations getHitFaceData returns wrong face.
Here is a small gif demo.
Bug is not very stable, you need large faces, high camera FOV, some special camera view etc. Nothing unusual actually.
Anyway, test scene simulates this “problem” case, so you can’t just move camera or subdivide mesh and voila 
Right now I’m forced to use workaround with RayMeshGridIntersect and I hope somebody can help me with this Painter behaviour
Test scene build script:
(
fn BuildScene =
(
delete objects
p1 = plane length:3000 width:5120 lengthsegs:1 widthsegs:1
p2 = plane length:3000 width:8831 lengthsegs:1 widthsegs:1
p1.transform = (matrix3 [-1.62921e-007,-1,0] [-1.62921e-007,0,1] [-1,1.62921e-007,-1.62921e-007] [2770.24,-293.851,1500])
p2.transform = (matrix3 [1,0,0] [0,-1.62921e-007,1] [0,-1,-1.62921e-007] [-2145.67,5988.01,1500])
newMesh = convertToMesh p1
attach newMesh p2
newMesh.name = "PainterNodeTest"
select newMesh
cam = Freecamera fov:115
cam.transform = (matrix3 [0.224951,-0.97437,0] [-0.0340051,-0.00785069,0.999391] [-0.973776,-0.224814,-0.0348996] [-2772.32,2634.33,1599.43])
viewport.setType #view_camera
)
BuildScene()
)
And Painter bug itself
(
local faceIndex = 0
local bary = [0,0,0]
local theNode = $PainterNodeTest
fn StartStroke = ()
fn EndStroke = ()
fn CancelStroke = ()
fn SystemEnd = thePainterInterface.endPaintSession()
fn PaintStroke =
(
if thePainterInterface.getIsHit 0 then
(
thePainterInterface.getHitFaceData &bary &faceIndex theNode 0
setFaceSelection theNode #{faceIndex}
)
)
fn StartPaint =
(
if theNode != undefined then
(
select theNode
max modify mode
if thePainterInterface.InPaintMode() then
(
thePainterInterface.endPaintSession()
)
subobjectlevel = 3
thePainterInterface.offMeshHitType = 2
thePainterInterface.initializeNodes 0 #(theNode)
thePainterInterface.scriptFunctions StartStroke PaintStroke EndStroke CancelStroke SystemEnd
thePainterInterface.startPaintSession()
)
)
StartPaint()
)
