0 Favourites

Line of Sight "field of view"

This forum is currently in read-only mode.
  • Well, having an field of view for it... so, if an actor is, for example, 300 pixels from the object with the behavior, it can't see the actor, even if he's not behind an obstacle,,,

    Well, I can make something like this, using a mask, but well, it's better having it on the behavior don't you think?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • instead of using a mask, i believe it is more efficient (and simpler) to just add an extra condition to your LoS-event:

    + Sprite has LoS to Target
    + Compare: Distance( Sprite.X, Sprite.Y, Target.X, Target.Y ) Less Than 300
        -> ...[/code:akr5ng2v]you could also have the field of view limited by angle, so the actor behaves more 'realistic' (e.g. can't look in the opposite direction he's walking):
    [code:akr5ng2v]+ Sprite has LoS to Target
    + Compare: AngleDiff( Sprite.Angle, Angle( Sprite.X, Sprite.Y, Target.X, Target.Y )) Less Than 45
        -> ...[/code:akr5ng2v](the last one was actually what i thought you had meant when typing 'field of view')
    it's rather easy to do in events when you know how, but i agree that the scenario might be rather common.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[Behavior] Grid based sight
58 36,789
Syazanie Amirin's avatar
Syazanie Amirin
Unread hot topic
33 7,992
Lovelocke64's avatar
23 55,946
Rexu's avatar