Position Velocity
Functions
Section titled “Functions”anyEntityCloserThan()
Section titled “anyEntityCloserThan()”anyEntityCloserThan(
entities,position,distance):boolean
Defined in: packages/isaacscript-common/src/functions/positionVelocity.ts:14
Parameters
Section titled “Parameters”entities
Section titled “entities”readonly Entity[]
position
Section titled “position”Vector
distance
Section titled “distance”int
Returns
Section titled “Returns”boolean
anyPlayerCloserThan()
Section titled “anyPlayerCloserThan()”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).
Parameters
Section titled “Parameters”position
Section titled “position”Vector
distance
Section titled “distance”float
Returns
Section titled “Returns”boolean
findFreePosition()
Section titled “findFreePosition()”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.
Parameters
Section titled “Parameters”startingPosition
Section titled “startingPosition”Vector
The position to start searching from. If this position is not overlapping with anything, then it will be returned.
avoidActiveEntities?
Section titled “avoidActiveEntities?”boolean = false
Optional. Default is false.
minimumDistance?
Section titled “minimumDistance?”float
Optional. If specified, will ensure that the randomly generated position is equal to or greater than the distance provided.
Returns
Section titled “Returns”Readonly<Vector>
getEntityPositions()
Section titled “getEntityPositions()”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.
Parameters
Section titled “Parameters”entities?
Section titled “entities?”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.
Returns
Section titled “Returns”ReadonlyMap<PtrHash, Vector>
getEntityVelocities()
Section titled “getEntityVelocities()”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.
Parameters
Section titled “Parameters”entities?
Section titled “entities?”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.
Returns
Section titled “Returns”ReadonlyMap<PtrHash, Vector>
setEntityPositions()
Section titled “setEntityPositions()”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.
Parameters
Section titled “Parameters”entityPositions
Section titled “entityPositions”ReadonlyMap<PtrHash, Vector>
The map providing the positions for every entity.
entities?
Section titled “entities?”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.
Returns
Section titled “Returns”void
setEntityVelocities()
Section titled “setEntityVelocities()”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.
Parameters
Section titled “Parameters”entityVelocities
Section titled “entityVelocities”ReadonlyMap<PtrHash, Vector>
The map providing the velocities for every entity.
entities?
Section titled “entities?”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.
Returns
Section titled “Returns”void
