GSC reference › Built-in
PositionQuery_Filter_DistanceToGoal()
Built-in (engine)
Server
Calculate the distance to <entity>.goalpos. If the point is in <entity>.goalradius, the distance will be 0. the result is in pointStruct.distToGoal
Signature
PositionQuery_Filter_DistanceToGoal(<queryStruct>, <entity>)
Parameters
| Name | Required? | Details |
|---|---|---|
| queryStruct | Required | result from PositionQuery_Source function." |
| entity | Required | the entity used to check goal." |
Example (from Treyarch's docs)
PositionQuery_Filter_DistanceToGoal( queryResult, self )
Real uses in BO3's scripts
Called 21 times in the decompiled scripts. A few, zombies first:
- scripts/shared/ai/warlord.gsc, line 177
positionquery_filter_distancetogoal(queryresult, entity); - scripts/shared/vehicle_ai_shared.gsc, line 2350
positionquery_filter_distancetogoal(queryresult, self); - scripts/shared/vehicles/_amws.gsc, line 828
positionquery_filter_distancetogoal(queryresult, self); - scripts/shared/vehicles/_hunter.gsc, line 464
positionquery_filter_distancetogoal(queryresult, self); - scripts/shared/vehicles/_parasite.gsc, line 532
positionquery_filter_distancetogoal(queryresult, self);
Related built-ins
- PositionQuery_Filter_InClaimedLocation()Check if the locations are inside other sentients claimed locations <entity>.inClaimedLocation.
- PositionQuery_Filter_Sight()Sight filter do sight check on each of the positions to a target position, and store the result in pointStruct.visibility (boolean).
- PositionQuery_Filter_Directness()Directness filter compute the direction information for each of the positions, relative to <origin> and <target>.
- DistanceSquared()Returns the squared distance between two points - this is cheaper than the actual distance as it doesn't involve a square root
- SetGoal()Set this AI 's goal.
- Distance2DSquared()Returns the squared distance between two points, ignores height difference.
- Distance()Returns the distance between two points
- PositionQuery_Source_Navigation()Generate points around <origin>, between <minSearchRadius> and <maxSearchRadius> and within <halfHeight> height difference.
- SetVehGoalPos()Set the target position for this vehicle.
- SetFilterPassConstant()Sets the filter pass constant
- Distance2D()Returns the distance between two points, ignores height difference.
- SetFilterPassEnabled()Sets the filter pass enabled or disabled
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).