CheckPosition

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


Actor

bool CheckPosition(Vector2 pos, bool actorsonly, FCheckPosition tm)

Usage

Checks if the Actor is colliding with anything at the given position.

Parameters

  • Vector2 pos
The xy position to check at. This is not relative to the Actor.
  • bool actorsonly
False by default. If true, ignores all lines.
  • FCheckPositon tm
Default is null. A FCheckPosition struct that will be filled with the relevant information.

Return value

Returns true if nothing is blocking the Actor at the position.

The function also fills the values of the FCheckPosition struct, which has the following fields:

  • Actor thing
Pointer to the actor whose position is stored in this struct.
  • Vector3 pos
Absolute coordinates of the actor whose position is stored in this struct.
  • Sector cursector
Pointer to the sector at the current position.
  • double floorz
Absolute highest floor height at pos. If the caller is stepping on top of another actor then this is the top of that actor.
  • double ceilingz
Absolute lowest ceiling height at pos.
  • double dropoffz
Absolute highest floor height at pos.
  • TextureID floorpic
A TextureID of the cursector's floor texture.
  • int floorterrain
Terrain data of cursector's floor.
  • Sector floorsector
Pointer to the lowest sector at pos, if portals are involved. Otherwise, same as cursector.
  • TextureID ceilingpic
A TextureID of the cursector's ceiling texture.
  • Sector ceilingsector
Pointer to the highest sector at pos, if portals are involved. Otherwise, same as cursector.
  • bool touchmidtex
True if actor at pos is touching a 3D middle texture.
  • bool abovemidtex
True if actor at pos is above a 3D middle texture.
  • bool floatok
If true, the caller can freely move up and down if it floats. This is used to signal the position wasn't fully blocked by a line or actor in TryMove.
  • bool FromPMove
This is true if this struct was instantiated by P_Move(). If true, handles non-players overlapping inside of each other by trying to unstick them if possible.
  • line ceilingline
The line the actor collided with if it hit an upper line part. This is set in case a lower line part also blocks, allowing both the floor and ceiling lines to be checked.
  • Actor stepthing
Another actor the thing stepped up on, if any.
  • bool DoRipping
If true, the caller is treated like a ripping projectile.
  • bool portalstep
True if the line edge at pos goes through a ceiling portal by going up a step.
  • int portalgroup
The index of the portal group the move goes to if portalstep is true.
  • int PushTime
Sets any pushed actor's lastPush field to this value. Used to track which actors were already pushed that move step.

See the FCheckPosition struct page for all details.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also