Hey all
So I've been making something in Yeti3D recently, and I've hit upon a problem. I'm trying to make environmental objects the player can inspect from any side, provided that they're looking towards the object. I've been using a function that Ecko wrote, a long time ago, to fix Bennu/Fenix/DIVs angle wraparound issue, however after a few hours of programming I've discovered angles don't work the same way in Yeti3D - for one, the maximum turn (t, Yeti3Ds version of angle - for looking around using the X axis) that an entity can have isnt as high as the default Bennu angle variable.
What I've been trying is this:
players_angle=playerpos.t; // in player process, after LOOP;
...
// in environmental object process
if (exists(type player));
player_id=get_id(type player);
end
lookatme_angle=get_angle(player_id);
check_player_angle=closest_angle(players_angle, lookatme_angle);
if (yeti_getdistance(placeholdermodelpos, playerpos)<col_radius and check_player_angle<col_span);
// do thing
end
...
// closest angle process
function closest_angle(angle1, int angle2); // Thanks Ecko :)
private
result;
begin
result=(angle2-angle1)%360000;
if (result>180000)
result-=360000;
else
if (result<-180000);
result+=360000;
end
end
if (result<0);
result=abs(result);
end
return (result);
end
I'm just not getting good results - is there something I'm missing, or something someone else could suggest for some good check-if-the-player-is-looking-at-something code??
Thanks guys
Dani