From SRB2 Wiki
(Redirected from Polyobject)
Jump to: navigation, search

A PolyObject is a group of linedefs that can move horizontally, creating the illusion of freely movable sectors. Because SRB2's rendering system relies on pre-calculated information (which is created during the nodebuilding process), normal level geometry is forced to be static. PolyObjects offer a way to circumvent this: The level geometry for the PolyObject is created outside of the main map, while in the map itself it is only represented by a single reference point. During runtime, the game dynamically inserts the PolyObject at the reference point. The reference point can be moved around in the map, thus creating horizontally moving level geometry.

PolyObjects can interact freely with the player and other Objects, and they will carry solid Objects standing on top of them. However, they should never collide with each other or static walls, which will lead to rendering errors. They can move across sector boundaries, but visual glitches may occur if a PolyObject moves into a sector with different properties from the one used for spawning it. PolyObjects should always be convex, since concave PolyObjects are rendered incorrectly, but this can be circumvented by splitting the concave object into multiple convex PolyObjects.


See also: PolyObject tutorial
Player standing on a moving PolyObject.

At the point in the map where you want the PolyObject to spawn, place a PolyObject Spawn Point. Each PolyObject is referred to by a unique ID, which you can choose freely. Set the Angle of the spawn point to this ID. Then, the level geometry for the PolyObject must be created outside the main map. First, draw a sector that will contain the PolyObject. Give this sector the same properties (floor height, ceiling height, flats and light level) as the sector in which you placed the spawn point. Inside that sector, draw the PolyObject itself so that all linedefs face outwards. The sector that they enclose will be called the PolyObject sector from now on. Its floor and ceiling height set the floor and ceiling height of the PolyObject. Each linedef's front middle texture will be rendered as the PolyObject's texture on that side. By default, the textures are drawn only once, even if they do not stretch to the full height of the PolyObject. To stack them, check the Repeat Midtexture flag and give the linedefs a front X offset that equals the PolyObject's height.

Place a PolyObject Anchor somewhere within the PolyObject sector or the surrounding sector and set its Angle to the PolyObject's ID. When spawning the PolyObject, this is the point that overlaps with the spawn point. For rotating PolyObject, this point is the axis that the PolyObject will rotate around. Give one linedef of the PolyObject linedef type 20 and an unused tag. This is the PolyObject's First Line, and it is used to identify the PolyObject. Another control sector is needed to specify the parameters. Give one of its linedefs linedef type 22 and tag it to the PolyObject's First Line. Set the floor height of the control sector to the PolyObject's ID.

By default, PolyObjects will not display any flats. To enable them for a PolyObject, the Solid Midtexture flag should be checked on the PolyObject's First Line – the PolyObject sector's floor and ceiling flats will be set as the top and bottom flats of the PolyObject respectively.

The following linedef types are used for PolyObject setup:

  • Linedef type 20: First Line – Must be given to one of the PolyObject's linedefs for identification.
  • Linedef type 21: Explicitly Include Line – Has no noticeable effect in the current version of SRB2.
  • Linedef type 22: Parameters – Sets the parameters for a PolyObject.
  • Linedef type 30: Waving Flag – Used to shift parts of the PolyObject back and forth, creating a waving effect.
  • Linedef type 31: Displacement by Front Sector – Used to scroll a PolyObject in a particular direction, by changing the heights of the linedef's front sector.

The following Thing types are used for PolyObject setup:


PolyObjects are able to perform actions through the use of linedef executors. SRB2 includes twelve types of linedef executors for PolyObjects, which allow them to move, rotate, disappear/reappear or change their translucency.

PolyObjects can trigger linedef executors just like regular sectors. To do this, give the desired trigger sector special to the PolyObject sector and tag it to a trigger linedef. If the Not Climbable flag is checked on the PolyObject's First Line, linedef executors can be triggered when a player explicitly lands on the PolyObject (as opposed to just standing on the PolyObject, or stepping up/down onto it from elsewhere). In this case, no sector special is needed – any trigger linedef with a tag of 32000 plus the PolyObject's ID will be triggered automatically.

The following actions can be performed by PolyObjects:


Certain linedef flags can be set on a PolyObject's First Line:

  • If the Slope Skew flag is set, only the outer sides of the PolyObject are rendered. Since the inner sides are usually not meant to be visible anyway and thus have no texture applied to them, it is rarely necessary to set this flag.
  • If the No Midtexture Skew flag is set, the PolyObject will be intangible.
  • If the Peg Midtexture flag is set, the PolyObject will stop any movement if it comes in contact with a pushable Object.
  • If the Solid Midtexture flag is set, the PolyObject's flats will be rendered.
  • If the Not Climbable flag is set, the PolyObject activates any trigger linedefs whose tag is 32000 plus the PolyObject's ID when a player lands on the PolyObject (as opposed to just standing on the PolyObject, or stepping up/down onto it from elsewhere).

Additionally, the Repeat Midtexture can be checked on each of the PolyObject's linedefs to tile the texture on that linedef. The front X offset specifies the height to which the texture is tiled. If the Repeat Midtexture flag is not checked, the texture is only displayed once and not tiled.

Examples of PolyObjects in official levels

  • Near the beginning of Techno Hill Zone Act 2 is a room where the player has to jump across platforms that are periodically blocked by blocks that slide in and out of the walls. These blocks are implemented with PolyObjects that use the Move, Override effect. The movement is triggered once on level load with linedef type 399 and is then periodically repeated with the use of linedef type 450 and a timing effect.
  • The elevator at the end of Techno Hill Zone Act 2 has two sliding doors that use the Move effect to close and open.
  • The gates before the castle at the end of Castle Eggman Zone Act 1 are PolyObjects that use the Rotate Right, Override and Rotate Left, Override effects to open.
  • The cannonball room in Castle Eggman Zone Act 2 features two waving flags.
  • As part of a secret, Castle Eggman Zone Act 2 features a bookcase that can be pushed open to reveal a hidden passage. The setup is complicated but mostly revolves around a continuous trigger coupled with a Rotate Left effect, which creates the illusion that the PolyObject is being pushed.
  • Arid Canyon Zone Act 1 features a chair lift that transports the player across a pit when stepped on. The trigger is set up with the Not Climbable flag, while the movement action is Door Slide.
  • As part of a secret, Arid Canyon Zone Act 1 features a crate that can be pushed into an machine that drains a pool of oil, revealing a hidden passage underneath. Upon being touched, the Move effect is used to slide the crate. Because the crate only moves a short distance, the illusion that the player is pushing it is upheld even though it moves by itself.
  • At the beginning of Egg Rock Zone Act 2, the player has the choice between two rooms that both contain a button that opens the door to the rest of the level. The room to the right contains two sliding panels that the player has to navigate. These panels are PolyObjects that move with the Move by Waypoints effect, triggered on level load. The room to the left features five fans that the player has to navigate over. The visual effect for the fans is provided by rotating PolyObjects.
  • At the beginning of the left path of Egg Rock Zone Act 2 is an outdoor room in which the player has to press a sideways button to open a door. Both the button and the door are PolyObjects that function like the oil draining machine in ACZ1 and the door in THZ2, respectively.
  • On the left path of Egg Rock Zone Act 2 is a room with a large door that periodically opens and sucks players into space. Before the player can enter the room, the effect is demonstrated with three crates that are sucked into space. These crates are PolyObjects that move with the Move by Waypoints effect.
  • Right after the space suction room, there is a small room with several crushers, some of which are sideways. The right path contains a section with sideways crushers as well. These crushers are PolyObjects that move with the Move by Waypoints effect, triggered on level load.
  • Near the end of Egg Rock Zone Act 2, the player has to pass two rotating gears. These gears are made up of rotating, crushing PolyObjects. Since the gears as a whole would be concave, each cog is a separate PolyObject.
  • The laser miniboss at the end of Egg Rock Zone Act 2 is a PolyObject that uses the Move by Waypoints effect and a complicated linedef executor setup to chase the player.

Parent/Child PolyObjects

PolyObjects are additionally capable of being linked to each other by being made "parent" or "child" PolyObjects to each other. This means that whenever a "parent" PolyObject is made to move or rotate in any way, its "child" PolyObjects will be automatically made to do the same actions. This does not apply to linedef types 489, 490 or 491.

To set up a PolyObject as a child of another, in addition to the normal setup, the control sector of the PolyObject's Parameters linedef should have its sector special value set to the PolyObject ID of the PolyObject to designate as its parent. Parent PolyObjects themselves can be set up as normal.

This feature is not currently used in any official level in SRB2 v2.1.

See also