SetOrigin

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


Actor

void SetOrigin (vector3 newpos, bool moving)

Usage

SetOrigin sets the actor's world coordinates to the specified position. Unlike SetXYZ, SetOrigin automatically relinks the actor to the blockmap and sectors. This is preferable over A_Warp when there's no need to add relative offsets to the warp position.

Parameters

  • vector3 newpos
The new position to go to.
  • bool 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
    }
 }