Physics proxies Documentation

From Nexus Mods Wiki
Jump to: navigation, search

Purpose of physics proxies

Physics proxies are very important part of an asset because they:

  • block movement - objects with physics proxies (player/NPC, house, sword...) cannot pass through each other
  • produce hit reactions - when one objects hits another, it can, for example, trigger a sound effect or place a decal.
  • allow enabling of the physics simulation - when you drop an object with physics proxy from you inventory, it will realistically fall down and won't get stuck in the air

When should an asset have a physics proxy

Not all assets need physics proxies. Because:

  • every proxy eats up limited resources (memory when streamed in, CPU time every time the physics is tested)
  • adds complexity to physics of the level (the more complex collisions in the level the bigger the harder time player/NPCs have navigating through it)

In general, small assets like small stones, twigs, bowls and cups don't need physics proxies. However if these are supposed to be pickable, than they need it.

1) How to create a proxy

Proxies are created in 3ds Max, linked on the mesh which they represent. Proxies can be a mesh or preferably some primitives. The simplicity of proxy for collision calculation from simpliest to most dificult is: sphere, capsule, cylinder, box, trimesh 

Using primitives is usually better. However try to stay as close to objects true shape as possible. Some calculations are dependent on shape, for example a thrown rock hitting cube with spherical proxy will bounce off strangely.

In case of primitives, the type of primitive has to be stated in Object Properties.

This shows the linking of proxies in scene and primitive definition in Object Properties dialog in 3ds Max.


Collision and Merge node

If you use Merge node, proxy meshes are linked directly to the Merge node. In order for the exporter to recognize proxy primitives, they have to have "proxy" string somewhere in them.

Collision bbox

Also for some calculation (e.g. line of sight) in engine the bounding box of a collision is used. Therefore it's important to check that in the Editor and make sure it doesn't deviate much from the actual proxy. To do that, write p_draw_helpers s_t(1) into console and hit Enter. Something like this will show up (those violet wire boxes around each proxy):

RTENOTITLE    This is goooood!

RTENOTITLE       But this is baaaaad!

The second bounding box doesn't respect the geometry much. I would be much better to split the collision proxy into more pieces.

2) Proxy material

All proxies have the same material as the object they're proxying for. Also if we want the proxies to represent different surface types ,more submaterials have to be assigned to them. Let's say I make a pickaxe... the handle will have proxy with material ID 1 and the metal part will have material ID 2. To these IDs I then assign different physicalised submaterials. In this case IDs 3,4 ... 32 can be used for  standard non physical materials.


3) Engine side - surface type

Surface type for different proxies is then set in editor's Material editor.

It affects:

  • sound triggered during hit reaction
  • partical effect spawned during hit reaction
  • decal placed on the asset during hit reaction
  • pierceability of the asset (when shot at)
  • transparency (whether NPCs will see through the object, e.g. through bushes or glass) 
  • walkability (whether navmesh is generated on the asset)
  • whether horse ignores that collision
  • whether only horse collides
  • whether only player collises
  • whether it's a special stair collision
  • etc.



In case you can't find proper surface type, you can add one yourself to W:\WH\Game\Libs\MaterialEffects\SurfaceTypes.xml, however this should be done a upon agreement of the leader.

Naming of them should be self-explanatory, hovewer there might be some confusion. See brief overview of some of the surface types:

  • fabric – for apparel assets made of fabric, only (it bleeds when you shoot it :) )
  • fabric items – for non-wearable assets made of fabric, i.e. laundry on the line, curtains etc.
  • sack – for assets made of fabric which are not meant to be shot through, for example sack
  • wood – general wood assets
  • wood_unwalk – wood assets we know player or NPC will never be able to walk on; this will not generate navmesh and therefore save memory and reduce complexity of path finding
  • player_only – such a collision blocks only player's movement
  • horse_only  – such a collision blocks only horse's movement
  • slope, stairs_wood, stairs_stone – special surface types for stairs

You can display collisions in the scene by using cVar p_draw_helpers 1. Notice how different surface type is showed in different color (wood – brown, thatch – yellow etc.). Every physical proxy should have defined some surface type and you can easily spot missing surface type by bright purple color.


Barrow on the right has missing (has default) surface type

Visual mesh as physical proxy

In very rare ocasions, you can use visual mesh itself as physical proxy instead of making extra mesh/primitive:

  • for terrain assets where proxy should follow visual mesh precisely
  • for testing purpose

To do that, just set material ID property in 3ds Max as following:


Editor object as proxy

There is a way how to create physical proxy right in the editor by using editor object - Designer. Create Designer (to by found in Objects rollout) to your liking and assign proxy material to it (for example Materials/default/collision_proxy_material). This method could be used for example to prevent player from getting stucked in some complicated area by blocking it with Designer object.