Lumberyard
User Guide (Version 1.15)

 AWS Documentation » Amazon Lumberyard » User Guide » Working with Component Entities » Component Reference » Polygon Prism Shape

# Polygon Prism Shape

 This feature is in preview release and is subject to change.

You can use the Polygon Prism Shape component to define a volume. A right polygonal prism is a 3D prism made from two translated polygons connected by rectangles. The Polygon Prism Shape component is defined by one polygon and a height property. All vertices lie on the local plane, where z = 0. The polygon is defined in the xy-plane of the entity. All vertices are in the local space of the entity. You can use the Polygon Prism Shape component with the Trigger Area component to create a volume for the trigger area bounds.

Note

The Polygon Prism Shape component supports only simple polygons; it cannot have self-intersecting sides. Parallelogram sides are not supported.

## Polygon Prism Shape Component Properties

The Polygon Prism Shape component has the following properties:

Visible

Displays the shape in the Lumberyard Editor viewport, whether the entity to which the component is attached is selected or not.

Default value: `True`

Height

The height of the polygon prism shape, in meters.

Default value: `1.0`

Vertices

The vertices that define the shape of the polygon prism, which is a Vector2. The component must have at least three vertices to form a valid polygon prism.

By default, when you add the Polygon Prism Shape component to an entity, the component has four vertices.

## Working with Polygon Prism Components

Each vertex has one planar and two linear manipulators; combined, these are called the translation manipulator. You can use the translation manipulator to move the vertices. The translation manipulator limits moving a vertex only to the xy-plane. No surface manipulator is present as all vertices must exist on the same plane. You cannot change the z-position of the polygon in the local space.

To change the vertex positions

• Do one of the following:

• In the Polygon Prism Shape component property window, change the vertex values.

• Select a vertex. In the translation manipulator, click and drag the green or red arrow to the position that you want.

Note

The manipulators follow the grid snap setting that you can configure in the Lumberyard Editor toolbar.

You can use the blue arrow in the center of the volume to change the height.

To change the height of the polygon prism

• Drag the blue arrow to change the height of the polygon prism.

Note

If the entity is scaled, the manipulators continue to behave correctly, but the scaling must be uniform, so that the x, y, and z scale values match.

To select multiple vertices

• Press Shift and then select the vertices that you want. Selected vertices appear yellow.

Note

Currently, you cannot click and draw a box around the vertices to select them.

You can also snap a vertex to another position on the terrain.

To snap a vertex to another position

1. Select a vertex.

2. Hold Shift+Ctrl and then click another position on the terrain. The vertex snaps to that position.

You can also add vertices to the polygon prism.

To add a vertex to the polygon prism

1. Pause on a line and hold Ctrl. A preview appears where you can add a vertex.

2. Click to add the vertex to the polygon prism.

You can also delete vertices from the polygon prism.

To delete a vertex from a polygon prism

1. Hold Alt and pause on a vertex. The vertex appears gray.

2. Click the vertex to remove it from the polygon prism. You can also select a vertex and press Delete.

## EBus Request Bus Interface

Use the following request functions with the `PolygonPrismShapeComponentRequestBus` EBus interface to communicate with other components of your game. The Polygon Prism Shape component also uses `VertexContainer` functions. For more information, see Vertex Containers.

For more information about using the event bus (EBus) interface, see Working with the Event Bus (EBus) System.

### GetPolygonPrism

Returns a constant pointer to the underlying polygon prism shape data.

Parameters

None

Return

AZ::ConstPolygonPrismPtr

Scriptable

Yes

### SetHeight

Sets the height of the polygon prism shape.

Parameters

Height

Default value: `1.0`

Min: `0.0`

Max: N/A

Return

None

Scriptable

Yes

### Example Polygon Prism Component EBus Request

The following script uses the request bus interface.

``````-- PolygonPrism Interface

local polygonPrism = PolygonPrismShapeComponentRequestBus.Event.GetPolygonPrism(self.entityId);

polygonPrism.height
polygonPrism.vertexContainer:Size()
polygonPrism.vertexContainer[1]

PolygonPrismShapeComponentRequestBus.Event.SetHeight(self.entityId, 5.0);

-- VertexContainer interface
local firstVertex = spline.vertexContainer[1];
local lastVertex = spline.vertexContainer[spline.vertexContainer:Size()];

-- Attention: You can use the bus interface directly, but here (at the moment at least) indexing will start from 0, not 1 as is the norm in Lua. Instead, you should use the functions directly on the VertexContainer, listed below