SetOrigin

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

void SetOrigin (vector3 newpos, bool moving)

Usage

This sets the actor's position. This is similar to SetXYZ, except this function is portal aware and can interpolate.

Note: Interpolation only works if the calling actor is setting its own position, and only after its own super.Tick() has been called, otherwise the function never sees the old position, only the new one. See [this thread] for details.

Parameters

  • newpos - The new position to go to.
  • moving - If true, the actor is interpolated from the old position to the new. Otherwise, they simply snap into place.

Examples

This imp ball always hits. Always.

class CheaterImpBall : DoomImpBall
{
    override void PostBeginPlay()
    {
        super.PostBeginPlay();
        if (target && target.target) //ensure that the shooter even has a target
            SetOrigin(target.target.pos+(0,0,target.target.height*0.5),false); //warp to middle of shooter's target
    }
 }