Making Mesh Physics

From Second Life Wiki
Jump to: navigation, search

Mesh physics background

Mesh objects in Second Life contain information about the appearance of the object visually, as well as the size and shape of the object for the physics engine, which controls how the environment and avatars can interact with the object. The simplest way to explain it is that if avatars had senses, the physics shape would be what they feel and touch, and the original mesh plus surface textures would be what they see. There is more general information about the Physics engine.

A model's physics shape will alter how the world interacts with the model. Usually it will be simpler than the visual appearance of the object. The physics shape is also known as the collision or colliding shape or model.

Unlike Second Life's default primitives which have a set system physics shape, you can create your own unique physics shape for your mesh objects. These should be as efficient as possible (the less vertices the better) and reflect the necessary physical shape of the object.

For example, if you make a very ornate carved stool in a mesh creation program, it might be important that the appearance of the stool is detailed, but for usage of the stool you might only need a cube or cylinder shape to represent how the object looks to the physics engine, to allow an avatar to sit on it. You wouldn't need the detailed carving on the stool to be represented to the physics engine.

Thus, you could upload the detailed model as the mesh object, but upload a very simplified shape as the physics model, to tell the physics engine how the object should behave in the virtual world. The advantage of this is that it will lower the land impact of the object and a simpler physics shape will help the physics engine deal with the object.


A solid physics shape like a cube or cylinder would prevent an avatar or Pathfinding creature from crawling under the stool. If it was important that something could be placed or go under the stool, for example, you might consider a physics shape which more closely follows the visual shape of the object, although it still wouldn't be necessary to include all the detail that can be seen.

Setting physics shape on upload

For prim and sculpty objects Second Life changes the level of detail (LOD) visible at a distance. When you upload a mesh object to Second Life, you are presented with a number of choices on the upload menu which will affect the appearance and the physics of your object. Information to help make these choices is given in Mesh/Upload_Model_UI_reference

For mesh objects the LOD can either be automatically created during the upload (see Mesh_and_LOD for instructions) and you can choose to use one of the LOD models to represent the physics of your object, or you can upload separate models for the different LODs and another for the physics shape of the object. (Potentially five separate models.)

Much will depend upon the purpose of the object and the level of interaction required between avatars, the environment and the object. You will find more detail about this step (2: Analyze) in Mesh/Decomposing_a_mesh_for physics_shape.

Automatic upload

You can opt for the uploading system to make the LOD and physics shapes of the object automatically. There are settings you can use to simplify the shape and these will lower the cost of the object in terms of the land impact, and reduce computational cost, which will help the Region you are using the object in.

Upload your own simplified shape

As well as the main model, you can opt to upload different versions of the model for lower, low and lowest LOD (level of detail) and you can either select one of these to represent the physics shape of the object or you can make your own physics shape and upload that with your object. This should always be the same dimensions and orientation as your original model, to ensure that it is uploaded correctly with your mesh.

While the Second Life mesh uploader will create a physical shape for you, see Mesh/Upload_Model_UI_reference, it's always better to make your own. You'll save in land impact and upload fees plus you have much more control over how the physical shape interacts with animated objects.

Physics weight after upload

You can see this information by rezzing a mesh object, selecting it and clicking the Edit> more info button on the edit menu. A small window will open up and the figures will be displayed. A model which is intended to be used as a vehicle must have a physics weight which is less than 32.

There is information about Mesh/Mesh Server Weight and land impact

Setting physics shape inworld

To lower the impact on Regions of a lot of complex shapes, it is possible to optimize the physics in a lot of objects by using a linked prim to represent the physical shape of the object.

You can link your mesh object to a prim which approximates the desired physics shape of the object, and then set your mesh object to PRIM_PHYSICS_SHAPE_NONE option. Physics Optimization gives more detail on this, showing how to use a prim for the collision on a tree.

Use a linked prim to make mesh physics none

Alternatively, if it is is unnecessary to have a physics shape for the object at all (traditionally, within Second Life, grasses and plants have fallen into this category for example) then you can use Physics Optimization to optimize the physics on a mesh object by making one or more mesh objects linked to a prim PRIM_PHYSICS_SHAPE_NONE. This will mean that the only part of the linked object which shows to the physics engine is the root prim.

Linking to other prims

Uploading meshes involves some complex calculations about an object's appearance, physics and rendering cost. When you link a prim of a different type, like a sculpty or a tortured prim, to a mesh, there may be some quite dramatic changes to Land impact. This is because some prims have a low land impact but others, especially cut and twisted torus prims, have a hidden impact which will become visible once you have linked them to a mesh. Having a cube as the root prim and setting the prim physics to none will lower this again.

Technical information about physics weight

There is more technical information available about Mesh/Mesh physics. You may also want to consult the section on Mesh and LOD which touches on some more areas to consider.

Note that setting an object to phantom does not remove it from the physics engine. To do this with any type of prim, use Physics Optimization


Back to Good_Building_Practices