Skip to main content

DistanceSense

A class in Root.Township, Alta.Intelligence.

Sense asset giving the ground distance between the creature and a target. Height differences up to yFlexibility are ignored.

Constructors​

MemberWhat it is
DistanceSense()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

1 private and internal field
MemberWhat it is
private float yFlexibilityHeight difference in metres that doesn't count towards the distance. Default 1.

Methods​

MemberWhat it is
override float Get(IAgent requester, ITarget target)The distance between the two ground positions, ignoring up to yFlexibility of height difference.
override float GetInverseLerp(IAgent requester, ITarget target, float from, float to)Maps the distance onto 0 to 1 between from and to, comparing squared distances first to skip the square root at the ends.