Ok, this is the essence of the problem:
the following (very simple) code,
should return a 1 or 2 for the "cansee#" variables, the "enemy" (the evil evil cube) obviously reacts to the player entity (the nice sphere).. but the checks to see whether the enemy can see the player return 0 all the time, which I don´t understand.
ai start
sync on
sync rate 60
cansee# = 0
cansee2# = 0
make object cube 1,3
`player object:
make object sphere 2,3
make object box 3,30,0.2,30
position camera 0,9.525,-28.15
position object 1,-10,2.6,10
position object 2,10,2.6,-10
AI Add Enemy 1,1
AI Add Player 2
do
if upkey() then move object 2,0.1
if downkey() then move object 2,-0.1
if leftkey() then move object left 2,0.1
if rightkey() then move object right 2,0.1
cansee# = AI Get Entity Can See ( 1, ai get player x(), ai get player z(), 1 )
cansee2# = AI Get Entity Can See ( 1, ai get player x(), ai get player z(), 0 )
ai update
gosub infoprint
sync
loop
infoprint:
set cursor 0,0
print "Player X: " + str$(ai get player x())
print "Player Z: " + str$(ai get player z())
Print "Cansee#: " + str$(cansee#)
Print "Cansee2#: " + str$(cansee2#)
return
Any help much appreciated, I know you can do it
edit: the controls etc are very simple simply to test, the end product features something a little more complicated