So I’m trying to test a pixel in an image. But when I overlap them with a 3d world. It just shows up as the background color, because it can’t access depth. (According to my knowledge) Here I’ll post some code.
pushMatrix()
setContext(screen)
background(0, 0, 0, 0)
perspective(FieldOfView,WIDTH/HEIGHT)
angle = (angle + RotationRate.y / math.abs(Gravity.y/2))
local x, y, z = math.sin(math.rad(angle)), Gravity.z , math.cos(math.rad(angle))
camera(0, 0, 0,x, y, z, 0, 1, 0)
rectMode(CENTER)
translate(0, 0, 100)
translate(0,0,0)
stroke(0, 2, 255, 255)
rect(0,0,5,5)
translate(50,0,0)
stroke(14, 255, 0, 255)
rect(0,0,5,5)
translate(-100,0,0)
stroke(255, 0, 3, 255)
rect(0,0,5,5)
color_red,color_green,color_blue = screen:get(WIDTH/2,HEIGHT/2)
setContext()
popMatrix()
ortho()
resetMatrix()
viewMatrix(matrix())
So I’m learning 3d programming by the way, so I know it looks sloppy. But can any one help me with this?