Difference between revisions of "FindClosestActor - Game"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rhavlovick
m (1 revision: Clobber re-import by Henning)
 
imported>Cipscis
(Added note about this function being able to return the player)
 
Line 24: Line 24:
Actor closest = Game.FindClosestActor(0.0, 0.0, 0.0, 5.0)
Actor closest = Game.FindClosestActor(0.0, 0.0, 0.0, 5.0)
</source>
</source>
== Notes ==
* The player is an actor, so this function can return the player if they are the closest actor to the passed coordinates.


== See Also ==
== See Also ==

Latest revision as of 18:00, 19 February 2012

Member of: Game Script

Finds the closest actor within a given radius of a location.

Syntax[edit | edit source]

Actor Function FindClosestActor(float afX, float afY, float afZ, float afRadius) native global

Parameters[edit | edit source]

  • afX: center of the search, X component
  • afY: center of the search, Y component
  • afZ: center of the search, Z component
  • afRadius: Maximum distance from center to look for an actor

Return Value[edit | edit source]

The closest actor found, none if none.

Examples[edit | edit source]

; Find the closest actor to 0,0,0, limiting the search to 5 units
Actor closest = Game.FindClosestActor(0.0, 0.0, 0.0, 5.0)

Notes[edit | edit source]

  • The player is an actor, so this function can return the player if they are the closest actor to the passed coordinates.

See Also[edit | edit source]