TryMove
Jump to navigation
Jump to search
Note: This feature is for ZScript only. |
native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null)
Usage
Tries to move the caller to the specified position if it's possible. For a function that only checks if the movement is possible without performing it, see CheckMove.
Parameters
- Vector2 newpos
- The xy location to move to. Note that this is absolute and not relative to the caller.
- int dropoff
- The maximum vertical distance the actor should be allowed to drop off. (Verification needed)
- bool missilecheck
- (Need more info)
- FCheckPositon tm
- Default is null. A FCheckPosition struct that will be filled with the relevant information.
Return value
Returns true if the caller was successfully moved to newpos.
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 ascursector
.
- 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 ascursector
.
- 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 [Structs:FCheckPosition|FCheckPosition struct]] page for all details.
Examples
![]() |
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. |