Physics Proxy Setup
Physics proxies are setup in the 3d application exclusively - the only setup needed in Sandbox Editor is the surface_type.
General Setup in 3d applications
The physik proxy is a super simple version of your render geometry. In Max you need to assign a separate material ID for the proxy and aslo make sure that all faces of your proxy have one smoothing group. According to the separate material ID you also need to create an extra submaterial for your proxy. This is physiklaized as physical Proxy in your crytek shader settings in 3DS max Material editor. The physik can only be changed here and not later in the editor. if you want to change the physic settings you need to reexport your object. The Physic Proxy is not allowed to have open edges. Open Edges can confuse the physic engine and have a negative affect on the performance. Its helpful to give assign an extreme color to the proxy to keep the overview.
Normally, special Node properties are not needed. The engine will automatically try to replace mesh physics proxies with parametric primitives, by comparing the proxy with some basic shapes and approximating the possible primitive within some calculative limits. The shape is created around the general bounding box of the geometry and uses the original pivot point to attempt to rotate the primitive to match the geometry as best as possible. Using primitives saves a lot of calculation time on collision tests (1 face = 1 primitve). It is therefore important to use primitives as much as possible.
By explicitly tagging the proxies with a certain value (see list below) in the Node Properties, the engine extends the limits and replaces the proxy geometry with the named primitive.
- nonphysical - used only characters which have no seperate phys skeleton. more info here.
Level of detail settings
proxies are only created for the LOD 0 - every succesive LOD step will take the proxy from the LOD0. same happens if different quality settings are used (Lowspec).
The physics proxies of environmental object (fences, crates, containers, trees, rocks, ladders, stairs, etc) should be VERY SIMPLE
The simplicity of the physics proxy is important for reducing redundant memory and physics calculations, but also for making the player movement smoother. The more complicated a proxy is, the more memory it takes, the more performance is lost on checking collisions against it's polygons and the more likely it is that the high frequency details will cause the player to get stuck or bounce undesirably against it. This affects both singleplayer and multiplayer, including the performance of a dedicated server. An ideal proxy is always a primitive (i.e. a box, a sphere, a capsule, or a cylinder). The engine recognizes primitives from meshes, but the default tolerance is very low; in order to force the recognition put the corresponding keyword ("box", "sphere", etc) into the node's user defined properties. Note, however, that 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's preferable to have a multipart object (i.e. "merge nodes" off) with primitive parts instead of a single part mesh object.
It is used for character movement and first pass tracing of projectiles (bullets and decals). The projectiles and decals are refined using the render mesh if a hit was detected against the phys proxy. The render mesh should be fully encapsulated by the physics proxy, so that player camera does not intersect the render geometry and first pass projectile culling does not miss the physical part of the object even though it hits the visual part of the object. There is also support for creating a special raytrace proxy that will be used for raytracing, if provided (they should be physicalized as "nocollide"). That would then allow the main proxy to not have to encapsulate the render mesh and thus be even simpler.
For example, simple object like crates and fences can mostly be approximated with a simple block, 6 sides, 12 triangles. The top of stairs should be simple ramps, 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 physical proxy.
Please talk to David Mondelore for further details.
Linking Objects to simplify export
Physics proxies can be part of the render object (in 3dsMax as an Element) or as a separate object, linked to the render object.
Setup in Sandbox
In Sandbox you need to assign a surfacetype to your physik proxy in the material editor, as well as to your render geometry. The surfacetype gives information about sound and particle effect of your surface. You also need to assign a NoDraw shader in the material editor. Also make sure that no textures are assigned to you proxy sub material. The Physic Proxy will never be rendered in the engine without debug view. even if you assign an illum shader it will stay invisible. To reload the physic proxy you need to reload your object, delte it and undo delte.
p_draw_helpers 1 shows the physics geometry. Parametric primitives are shown in a different rendering style.
Example picture without debug
Example picture with debug