Table of Contents

Interface IPlayerPositionHistory

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

The positions the player has stood on in the loaded game, and the search for a position near the player to place an actor.

public interface IPlayerPositionHistory

Remarks

A position is recorded each second while the player stands on the ground outdoors, 500 units or more from the last one recorded, and the latest 60 are retained. A load or a new game empties the record. Call members on the game's thread.

Properties

GroundedPosition

The player's position on the ground, or the mount's while riding. It is null while the player is in the air or swimming.

NiPoint3? GroundedPosition { get; }

Property Value

NiPoint3?

Methods

FindSpawnPosition(float, float, IEnumerable<NiPoint3>?)

Finds a position more than minimumDistance and less than maximumDistance units from the player, on ground an actor can stand on.

SpawnPosition? FindSpawnPosition(float minimumDistance, float maximumDistance, IEnumerable<NiPoint3>? candidates = null)

Parameters

minimumDistance float

The distance the position exceeds.

maximumDistance float

The distance the position is within.

candidates IEnumerable<NiPoint3>

Positions in the player's worldspace on which an actor can stand.

Returns

SpawnPosition?

The latest recorded position in range, then the first candidate in range, then the ground under a map marker in range, then the ground behind the player midway between the two distances, if that ground is in range. The result is null where none of them is found.

WaitForGroundAsync(TimeSpan, CancellationToken)

Waits up to timeout of unpaused time for GroundedPosition.

Task<NiPoint3?> WaitForGroundAsync(TimeSpan timeout, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan
cancellationToken CancellationToken

Returns

Task<NiPoint3?>

A task whose result is the position. The result is null where the player is not on the ground by then. A new game or a save load cancels the task.