# llSetPhysicsMaterial

*LSL function*

```lsl
void llSetPhysicsMaterial(integer mask, float gravity_multiplier, float restitution, float friction, float density);
```

- `integer mask`: Bitwise mask combination specifying which of the floats (DENSITY, FRICTION, RESTITUTION, or GRAVITY_MULTIPLIER) to apply.
- `float gravity_multiplier`: Gravity multiplier float value (range [-1.0, +28.0], default is 1.0).
- `float restitution`: Elasticity restitution float value (range [0.0, 1.0]).
- `float friction`: Friction coefficient float value (range [0.0, 255.0]).
- `float density`: Density float value in kg/m³ (range [1.0, 22587.0]).

- Energy: 10

Configures the physical characteristics of an object. The mask bitfield specifies which of the other parameters (gravity_multiplier, restitution, friction, or density) should be applied to the object.

Used to set the physical characteristics of an object.

```lsl title="How to use" frame="terminal"
llSetPhysicsMaterial(0, 0.0, 0.0, 0.0, 0.0);
```

## Specification

<table>
	<tr>
		<th>**mask** Flags</th>
		<th>V</th>
		<th colspan="6">Description</th>
	</tr>
	<tr>
		<td>[DENSITY](/constants/DENSITY/)</td>
		<td>1</td>
		<td colspan="6">Indicates that **density** parameter is enabled and will override the previous value.</td>
	</tr>
	<tr>
		<td>[FRICTION](/constants/FRICTION/)</td>
		<td>2</td>
		<td colspan="6">Indicates that **friction** parameter is enabled and will override the previous value.</td>
	</tr>
	<tr>
		<td>[RESTITUTION](/constants/RESTITUTION/)</td>
		<td>4</td>
		<td colspan="6">Indicates that **restitution** parameter is enabled and will override the previous value.</td>
	</tr>
	<tr>
		<td>[GRAVITY_MULTIPLIER](/constants/GRAVITY_MULTIPLIER/)</td>
		<td>8</td>
		<td colspan="6">Indicates that **gravity_multiplier** parameter is enabled and will override the previous value.</td>
	</tr>
</table>

## Caveats

- Using [PRIM_MATERIAL](/constants/PRIM_MATERIAL/) to set the material type will reset the values for **friction** and **restitution** to that material's defaults.
- [llSetPhysicsMaterial](/functions/llSetPhysicsMaterial/) silently fails if called from an attachment.

## Examples

<details open>
<summary>Example 1</summary>

- Basic Example

```lsl
     llSetPhysicsMaterial(FRICTION, 1.0,0.9,0.1,0.5); // Sets FRICTION to 0.1
```

</details>

<details>
<summary>Example 2</summary>

- Multiple Settings

```lsl
     llSetPhysicsMaterial(GRAVITY_MULTIPLIER | RESTITUTION | FRICTION | DENSITY, 0.5,0.9,0.1,1.0);
```

</details>

## Tests

- [Physics Material Settings test](https://wiki.secondlife.com/wiki/Physics_Material_Settings_test)

## History

Date of Release [23/09/2011](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/11#11-09-23-241511)

## See also

### Functions

- [llGetPhysicsMaterial](/functions/llGetPhysicsMaterial/)
- [llSetBuoyancy](/functions/llSetBuoyancy/) — Set how gravity interacts with an object. Works in attachments (changes are applied to the avatar).

---

*Source: [LlSetPhysicsMaterial](https://wiki.secondlife.com/wiki/LlSetPhysicsMaterial) on the Second Life Wiki. Content from the Second Life Wiki articles LlSetPhysicsMaterial (revision 1217245, 2024-09-08) and Template:LSL Function/physics materials (revision 1171967, 2012-08-23), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llSetPhysicsMaterial/
