Skip to content

Position Velocity

anyEntityCloserThan(entities, position, distance): boolean

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:14

readonly Entity[]

Vector

int

boolean


anyPlayerCloserThan(position, distance): boolean

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:30

Iterates over all players and checks if any player is close enough to the specified position.

Note that this function does not consider players with a non-undefined parent, since they are not real players (e.g. the Strawman Keeper).

Vector

float

boolean


findFreePosition(startingPosition, avoidActiveEntities?, minimumDistance?): Readonly<Vector>

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:53

Helper function to get a room position that is not overlapping with a grid entity, a heaven door, or a player. The Room.FindFreePickupSpawnPosition method will return locations that overlap with heaven doors and partially overlap with players, if the thing being spawned is bigger than a tile (like a Blood Donation Machine). Use this function instead if you want to account for those specific situations.

Vector

The position to start searching from. If this position is not overlapping with anything, then it will be returned.

boolean = false

Optional. Default is false.

float

Optional. If specified, will ensure that the randomly generated position is equal to or greater than the distance provided.

Readonly<Vector>


getEntityPositions(entities?): ReadonlyMap<PtrHash, Vector>

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:112

Helper function to get a map containing the positions of every entity in the current room.

This is useful for rewinding entity positions at a later time. Also see setEntityPositions.

readonly Entity[]

Optional. If provided, will only get the positions of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

ReadonlyMap<PtrHash, Vector>


getEntityVelocities(entities?): ReadonlyMap<PtrHash, Vector>

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:135

Helper function to get a map containing the velocities of every entity in the current room.

This is useful for rewinding entity velocities at a later time. Also see setEntityVelocities.

readonly Entity[]

Optional. If provided, will only get the velocities of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

ReadonlyMap<PtrHash, Vector>


setEntityPositions(entityPositions, entities?): void

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:162

Helper function to set the position of every entity in the room based on a map of positions. If an entity is found that does not have matching element in the provided map, then that entity will be skipped.

This function is useful for rewinding entity positions at a later time. Also see getEntityPositions.

ReadonlyMap<PtrHash, Vector>

The map providing the positions for every entity.

readonly Entity[]

Optional. If provided, will only set the positions of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

void


setEntityVelocities(entityVelocities, entities?): void

Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:190

Helper function to set the velocity of every entity in the room based on a map of velocities. If an entity is found that does not have matching element in the provided map, then that entity will be skipped.

This function is useful for rewinding entity velocities at a later time. Also see getEntityVelocities.

ReadonlyMap<PtrHash, Vector>

The map providing the velocities for every entity.

readonly Entity[]

Optional. If provided, will only set the velocities of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

void