Arx Libertatis Bug Tracker
star_faded.png
Please log in to bookmark issues
enhancement_small.png
CLOSED  Enhancement #1593  -  Add script system variables to see if an entity can see or is seen by another entity
Posted Dec 05, 2021 - updated Jan 13, 2022   Shortlink: http://arx.vg/1593
action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
icon_info.png This issue has been closed with status "Done" and resolution "RESOLVED".
Issue details
  • Type of issue
    Enhancement
  • Status
     
    Done
  • Assigned to
    Not assigned to anyone
  • Progress
       
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     Daniel Scharrer
  • Owned by
    Not owned by anyone
  • Estimated time
    Not estimated
  • Category
    Not determined
  • Resolution
    RESOLVED
  • Priority
    Not determined
  • Targetted for
    icon_milestones.png Not determined
  • OS
    icon_customdatatype.png Not determined
  • Architecture
    icon_customdatatype.png Not determined
  • Fixed in
    icon_customdatatype.png Arx Libertatis 1.3
Issue description
Motivational example: an enemy that only moves when the player is not looking at it.

For example `^cansee_<entity>` would return
  • -2 if <entity> is behind the calling entity
  • -1 if <entity> is outside the field of view of the entity but not strictly behind
  • 0 if <entity> is inside the field of view of the calling entity but definitely fully occluded (e.g. in another room)
  • 1 if <entity> is inside the field of view of the calling entity and possibly at least partially visible
  • 2 if <entity> is inside the field of view of the calling entity and is definitely at least partially visible (raycast hit from the head/view vertex of the calling entity to any group origin of <entity>?)
  • 3 if <entity>'s head is definitely visible from the calling entity (raycast hit from the head/view vertex of the calling entity to the head vertex of <entity>)


`^seenby_…` would have the same logic but the two entities reversed.

Should these variables check the distance at all? Maybe only check that the entity is within the draw distance (otherwise return -1/-2) and then the script can also check `^dist_<entity>` if it wants a lower limit.

#7
icon_reply.pngReply
Comment posted by
 Daniel Scharrer
Jan 13, 01:33
I have added ^onscreen* ^offscreen* system variables to test if an entity can be seen by the player, which is easier than doing it for any viepoint as we can re-use the culling infrastructure from the renderer.

NPC view cone tests are already available in AF 1.21 via the ifvisible script command. There is nothing to test NPC->player or NPC->NPC occlusion yet but I think its OK to close this for now and add additional system variables or commands when there is a need for them.

The issue was updated with the following change(s):
  • This issue has been closed
  • The status has been updated, from New to Done.
  • The resolution has been updated, from Not determined to RESOLVED.
  • This issue's progression has been updated to 100 percent completed.