Skip to content
lsl.devlsl.devLSL Dev

LlSetPhysicsMaterial

Looking for the current API? Open the llSetPhysicsMaterial reference →

Wiki description

Used to set the physical characteristics of an object.

Specification

mask Flags V Description
DENSITY 1 Indicates that density parameter is enabled and will override the previous value.
FRICTION 2 Indicates that friction parameter is enabled and will override the previous value.
RESTITUTION 4 Indicates that restitution parameter is enabled and will override the previous value.
GRAVITY_MULTIPLIER 8 Indicates that gravity_multiplier parameter is enabled and will override the previous value.

Caveats

  • Using PRIM_MATERIAL to set the material type will reset the values for friction and restitution to that material's defaults.
  • llSetPhysicsMaterial silently fails if called from an attachment.

Examples

  • Basic Example
     llSetPhysicsMaterial(FRICTION, 1.0,0.9,0.1,0.5); // Sets FRICTION to 0.1
  • Multiple Settings
     llSetPhysicsMaterial(GRAVITY_MULTIPLIER | RESTITUTION | FRICTION | DENSITY, 0.5,0.9,0.1,1.0);

See also: functions

Tests

History

Date of Release 23/09/2011

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/physics materials

Original shared helper source (conditional wiki logic is not evaluated)
<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{LSL Injection Test}}{{#if:

{{#vardefine:material_mask|mask}}

{{Footnote|The default values for friction and restitution depend upon the prim's [[PRIM_MATERIAL|material]].|The default values for friction and restitution depend upon the prim's material (PRIM_MATERIAL).|handle=material}}

<!-- caveats & parameter descriptions copied from PRIM_PHYSICS_MATERIAL article -->
{{#vardefine:p_{{#var:material_mask}}_desc|bitwise combination of [[DENSITY]], [[FRICTION]], [[RESTITUTION]], and [[GRAVITY_MULTIPLIER]] and specifies which floats to actually apply}}
{{#vardefine:p_gravity_multiplier_desc|range {{Interval|gte=-1.0|center=gravity_multiplier|lte=+28.0}}, default:&nbsp;1.0}}
{{#vardefine:p_restitution_desc|range {{Interval|gte=0.0|center=restitution|lte=1.0}}, default:&nbsp;{{Interval|gte=0.3|center=restitution|lte=0.9}} {{Footnote|handle=material}}}}
{{#vardefine:p_friction_desc|range {{Interval|gte=0.0|center=friction|lte=255.0}}, default:&nbsp;{{Interval|gte=0.2|center=friction|lte=0.9}}{{Footnote|handle=material}}}}
{{#vardefine:p_density_desc|range {{Interval|gte=1.0|center=density|lte=22587.0}} [[llGetMassMKS|kg]]/m^3, default:&nbsp;1000.0}}

{{#vardefine:p_{{#var:material_mask}}_hover|bitwise combination of DENSITY, FRICTION, RESTITUTION, and GRAVITY_MULTIPLIER and specifies which floats to actually apply}}
{{#vardefine:p_gravity_multiplier_hover|range -1.0 to +28.0, default:&nbsp;1.0}}
{{#vardefine:p_restitution_hover|range 0.0 to 1.0, default values are in the range 0.3 to 0.9 (note, a collision between two objects with restitution 1.0 will still not be perfectly elastic due to damping in the physics engine)}}
{{#vardefine:p_friction_hover|range 0.0 to 255.0, default values are in the range 0.2 to 0.9}}
{{#vardefine:p_density_hover|range 1.0 to 22587.0 (in kg/m^3), default:&nbsp;1000.0}}

{{#vardefine:physics_material_rows|
!{{!}} {{LSLPT|{{#var:material_mask}}}} Flags
! title="Value" {{!}} V
! colspan="6" {{!}} Description
{{!}}-
{{!}} {{LSL Const|DENSITY|integer|1}}
{{!}} {{#var:value}}
{{!}} colspan="6" {{!}} Indicates that {{LSLP|density}} parameter is enabled and will override the previous value.
{{!}}-
{{!}} {{LSL Const|FRICTION|integer|2}}
{{!}} {{#var:value}}
{{!}} colspan="6" {{!}} Indicates that {{LSLP|friction}} parameter is enabled and will override the previous value.
{{!}}-
{{!}} {{LSL Const|RESTITUTION|integer|4}}
{{!}} {{#var:value}}
{{!}} colspan="6" {{!}} Indicates that {{LSLP|restitution}} parameter is enabled and will override the previous value.
{{!}}-
{{!}} {{LSL Const|GRAVITY_MULTIPLIER|integer|8}}
{{!}} {{#var:value}}
{{!}} colspan="6" {{!}} Indicates that {{LSLP|gravity_multiplier}} parameter is enabled and will override the previous value.
}}

{{#vardefine:caveats|{{#var:caveats}}
* A collision between two objects with {{LSLP|restitution}} 1.0 will still not be perfectly elastic due to damping in the physics engine.
}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{PBR}}
The default values for {{LSLP|friction}} and {{LSLP|restitution}} depend upon the [[PRIM_MATERIAL|material type]].}}

{{#vardefine:history|{{#var:history}}{{PBR}}
* Content taken from [[Release Notes/Second Life Server/11#11.09.23.241511]]''
* Documentation expanded with information from [[Physics Material Settings test]].{{PBR}}}}


}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{#var:material_mask}}_desc}}
|-
{{VarPair|p_gravity_multiplier_desc}}
|-
{{VarPair|p_restitution_desc}}
|-
{{VarPair|p_friction_desc}}
|-
{{VarPair|p_density_desc}}
|-
{{VarPair|header_footnote}}
|-
{{VarPair|caveats}}
|-
{{VarPair|history}}
|-
{{VarPairTable|physics_material_rows}}
|}
</noinclude>
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.