Lumberyard
User Guide (Version 1.17)

# Geometry Guidelines and Best Practices

The following are some guidelines and best practices that should be taken into consideration when working with physics proxies.

The physics proxies of environment objects such as fences, crates, containers, trees, rocks, ladders, and stairs should be as simple as possible. Crates and fences can usually be approximated with a simple box with 6 sides (12 triangles). The top of stairs should usually be simple ramps, resulting in just 2 triangles. More organic or irregularly shaped objects like rocks and trees can still be approximated with a fairly simple hull by allowing slight and acceptable inaccuracies between the render mesh and the physics proxy.

The physics proxy should not have open edges. Open edges can confuse the physics engine and have a negative effect on performance. It is helpful to assign a bold color to the proxy in order to keep track of it.

Avoiding geometric complexity for physics proxies is not only important to reduce redundant memory requirements and physics computations, but also for making player movement smoother. The more complicated a proxy is, the more memory it takes and the more performance is lost when checking collisions against its polygons. This affects both single player and multiplayer games, including the performance of a dedicated server. Besides the performance issues, a complex proxy with a lot of concavity increases chances that the player can get stuck or bounce undesirably against the proxy.

An ideal proxy is always a primitive, such as a box, sphere, capsule, or cylinder. Lumberyard recognizes primitives from meshes but the default tolerance is very low. In order to force recognition, put the corresponding keyword (such as "box" or "sphere") in the node's user-defined properties. Meshes with several surface types cannot be turned into primitives. Primitives should be considered as an option even for more complex objects. In most cases it is preferable to have a multi-part object (Merge Nodes disabled) with primitive parts instead of a single-part mesh object.

The physics proxy is used for blocking character movement as well as first-pass tracing of projectiles. If a hit is detected against the physics proxy, projectile impact and decal locations are refined using the render mesh. The render mesh should be fully encapsulated by the physics proxy, so that the player camera does not intersect the render geometry and first-pass projectile culling does not miss the physical part of the object, even if it hits the visual part of the object. You can also create a special raytrace proxy that can be used for projectiles. This would allow the main proxy to not have to encapsulate the render mesh and thus the proxy could be even simpler.