SetXYZ

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

void SetXYZ (vector3 newpos)

Usage

This sets the actor's position without altering its blockmap links (and is NOT aware of portals)! This is good for, say, temporarily "imagining if" an actor were at a certain position for the sake of making specific calculations before restoring the actor's previous position in the same tic.

To set an actor's position permanently, blockmap links and all, use SetOrigin instead.

Examples

This function returns true if a given position has enough room for the caller's height.

    bool CheckZat(vector3 testpos) {
        vector3 oldpos = pos;
        SetXYZ(testpos);
        if(GetZAt(flags:GZF_CEILING)-GetZAt()<height){
            SetXYZ(oldpos);
            return false;
        }
        SetXYZ(oldpos);
        return false;
    }