PolyObjects

From ZDoom Wiki

Jump to: navigation, search
Doomwiki
For more information on this article, visit the polyobject page on the Doom Wiki.
Since the use of a precalculated BSP for rendering forces vertical level geometry to remain constant, it is impossible to move a structure on the X and Y axes in vanilla Doom. ZDoom addresses this problem by providing PolyObjects. A PolyObject consists of a group of connected one-sided lines contained in a single subsector.

Making a polyobject is fairly simple, though it may seem hard at first, once you get the hang of it you'll be able to crank them out in no time.

Poly01.pngFirst we need the actual map. I'll make a sliding door polyobject (arguably the easiest kind), so we'll need two rooms with ceiling heights of 192 and a middle corridor (which is where the polys will appear) with a ceiling of 128. All floors are at height 0.
Poly02.pngNext you need to construct the polyobjects. You should place them in a 'dummy' sector or another inaccessible place because the space they occupy on the map will usually still be considered blocked out, resulting in unwanted situations such as a swinging door that leaves an invisible barrier when opened. Note that the polyobjects are 'solid' columns of void composed of only 1-sided linedefs.

The lines marked in yellow should be Polyobj_StartLine which takes three arguments, the polyobject number, mirrored polyobject and the sound it makes while moving (defined in SNDSEQ). For the top poly you should use polyobject number 0, and for the bottom you should use number 1 (though any number from 0 - 255 would do). Since these polys will mirror one another (their actions will be the same, only in reverse, poly1 will open to the right and poly0 will open to the left for example) you should place the opposite poly number in the second field. Sound isn't important to us now, so just leave it zero.

Poly03.pngNow you have to place polyobject anchors and start spots. These will determine where the polyobjects actually get placed on the map. First place the anchors, which have DoomEdNum 9300. These should be placed within the polyobjects as you have them drawn on the map (or close to the edge), like in the image. The only important thing about the anchors is their angle, which should correspond to the polyobj number. So the anchor at the top has angle 0 and the anchor under it has an angle of 1.
Poly04.pngNext we place the start spots. These are placed in a similar way to the anchors; in a place where you want the polyobject to appear in game relative to the anchor. So in this case we placed the anchor in the center of the poly, so we want the start spot placed in the center of where we want the poly to appear, as shown in the image. Start spots have the DoomEdNum 9301, 9302 or 9303:
9301: Normal polyobject, it aborts its movement if it collides with an actor.
9302: Crushing polyobject, it continues to move and actors that get in the way are crushed.
9303: Harmful polyobject, it deals damage on touch even before the actor is crushed.
Poly05.pngHere we have a completed setup. Note that since ZDoom 2.5.0, you can have complex geometry for polyobjects and you can make them move anywhere you want in the map. Previous versions had strict limitations on what a polyobject could be and do. This example being already old, it shows a very simple setup.
Poly06.pngFinally, you probably want the polyobjects to actually open. This is quite simple, just give the wide sides of the polyobjects the Polyobj_DoorSlide special, with the arguments 0, 32, 128, 64, 105 which are polyobj number, speed of movement, angle (defined at the ZDoom editing ref), distance to move and delay before the polys shift back to their original position (in tics, 105 is 3 seconds (35 tics per second)). You need not worry about polyobject 1 in this case because it will mirror whatever polyobject 0 does. That's it, you're all done!
File:Polyexample.zip

For specials related to PolyObjects, see the following topics:

See also

Tutorials

Personal tools
Namespaces
Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox