Im trying to cast a ray in python.
The ray works, but it seems to hit the last face instead of the first face.
Picture:http://www.pasteall.org/pic/show.php?id=73253
Code, executes from Always sensor with frequency 0:
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
px = own.worldPosition.x
py = own.worldPosition.y
pz = own.worldPosition.z
xx = own.rayCast([px-1.0,py,pz], [px-1.0,py+10.0,pz], 10.0, "")
if xx[1]:
print('test: '+str(xx[1]))
bge.render.drawLine([px-1.0,py,pz], xx[1], [0,255,0])
main()
Blend: http://www.pasteall.org/blend/30088
Move object with arrows to test.
Im not sure how to solve this. Thanks for any help.