Warp (ZScript)
Jump to navigation
Jump to search
| Note: This feature is for ZScript only. |
| Note: Not to be confused with the ACS function Warp. |
native bool Warp(Actor dest, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, double heightoffset = 0, double radiusoffset = 0, double pitch = 0)
Usage
Warps the calling actor (by default) to the specified actor pointer. Generally, functions exactly the same way as A_Warp, but takes a ZScript actor pointer rather than a DECORATE AAPTR* pointer. In contrast to A_Warp, however, this cannot perform a state jump.
Note, for simple warping using SetOrigin is generaly preferable; Warp is only really necessary if there's a need to add relative offsets to the warping position.
Parameters
- Actor dest
- An actor pointer to warp the calling actor to.
- double xofs
- How far in front/behind of the
destactor the warping actor will appear. Positive numbers move the offset point forward, negative move it backward.
- double yofs
- How far to the right/left of the
destactor the warping actor will appear. Positive numbers move the offset point to the right, negative move it to the left.
- double zofs
- How far above/below the
destactor the warping actor will appear. Positive numbers move the offset point up, negative move it down. Note that at 0 the warping actor will be placed at the bottom of thedestactor.
- double angle
- Specifies how far the calling actor's angle will be offset from the
destactor's angle. At the default value (0) the calling actor's angle will become equal todest's angle. Positive values will offset the calling actor's angle to the right ofdest's angle, negative will offset it to the left.
- int flags
- Flags that affect the behavior:
- WARPF_ABSOLUTEOFFSET — Makes
xofsandyofsarguments function as absolute offsets along the X/Y axes of the map, ignoring thedest's angle. - WARPF_ABSOLUTEANGLE — Use the angle parameter as an absolute value to set the actor's angle to, instead of an offset from
dest's angle. - WARPF_ABSOLUTEPOSITION — Treat
xofs/yofs/zofsarguments as absolute coordinates for the warping actor's position instead of being relative to thedest's position. This flag overrides WARPF_ABSOLUTEOFFSET, but can still add the z offset of floorz when used with WARPF_TOFLOOR. - WARPF_USECALLERANGLE — Use the warping actor's angle instead of the warped-to actor's to calculate the
xofs/yofsoffsets. Theangleargument will instead add itself to the warping's angle and cause it to orbit around thedestactor. The greater theangleparameter, the faster it will orbit. - WARPF_NOCHECKPOSITION — Blindly accept any resultant position, instead of checking for the warp being a valid movement.
- WARPF_STOP — Reduce warping actor's velocity to 0 when the move is completed, similar to A_Stop.
- WARPF_TOFLOOR — Makes the
zofsparameter relative to the floor, rather than relative to thedest's Z position. - WARPF_BOB — Makes the warping actor copy the
dest's FloatBobPhase property. This is useful if the destination actor uses FLOATBOB. - WARPF_MOVEPTR — The
destwill warp to the calling actor rather than vice versa. - WARPF_COPYVELOCITY — Copies the
destactor's velocity exactly, regardless of how the warping actor is moving. - WARPF_COPYPITCH — Copies the
destactor's pitch, and then adds thepitchparameter to it.
- WARPF_ABSOLUTEOFFSET — Makes
- Flags to customize appearance of the warp:
- WARPF_INTERPOLATE — Keeps the warping actor's default interpolation data.
- WARPF_WARPINTERPOLATION — Modify interpolation data with the vector PlayerNewPosition - PlayerOldPosition.
- WARPF_COPYINTERPOLATION — Copies the warped-to actor's interpolation data, allowing the warping actor to mimic it.
- double heightoffset
- Adds the warped-to actor's height multiplied by
heightoffsetto thezofsparameter. Default is 0.
- double radiusoffset
- Adds the warped-to actor's radius multiplied by
radiusoffsetto thexofsandyofsparameters. Default is 0.
- double pitch
- With WARPF_COPYPITCH, this parameter works exactly as
angle, but with pitch instead. Without WARPF_COPYPITCH, this parameter merely adds to the warping actor's pitch.
Return values
- bool — Returns
trueif the warping succeeded. Warping may fail if the WARPF_NOCHECKPOSITION flag is not passed and there's no space for the warped actor to move.
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. |