Api Sandbox Surface
class

Surface

public class Surface : GameResource

A physics surface. This is applied to each PhysicsShape and controls its physical properties and physics related sounds.

Constructors

Surface()

Properties

Name Type Description
NameHash UInt32
Index Int32
BaseSurface String Filepath of the base surface. Use SetBaseSurface and GetBaseSurface.
AudioSurface AudioSurface Defines the audio properties of this surface for Steam Audio
Description String A concise description explaining what this surface property should be used for.
Friction Single Friction of this surface material.
Elasticity Single Controls bounciness.
Density Single Density of this surface material. This affects things like automatic mass calculation. Density is in kg/m^3.
RollingResistance Single Controls how easily rolling shapes (sphere, capsule) roll on surfaces.
BounceThreshold Single Velocity threshold, below which objects will not bounce due to their elasticity.
FluidLinearDrag Single Linear drag applied when submerged.
FluidAngularDrag Single Angular drag applied when submerged.
Dampening Single
ImpactEffects ImpactEffectData Impact effects of this surface material.
ScrapeEffects ScrapeEffectData Scrape effects of this surface material.
Sounds OldSoundData Sounds associated with this surface material.
PrefabCollection SurfacePrefabCollection Common prefabs for this surface material
SoundCollection SurfaceSoundCollection Sounds for this surface material
Tags String A list of tags as one string.

Methods

Surface GetBaseSurface()

Returns the base surface of this surface, or null if we are the default surface.

Void SetBaseSurface(String name)

Sets the base surface by name.

static Surface FindByName(String name)

Returns a Surface from its name, or null

name — The name of a surface property to look up
returns — The surface with given name, or null if such surface property doesn't exist
SoundHandle PlayCollisionSound(Vector3 position, Single speed = 320)

Play a collision sound based on this shape's surface. Can return null if sound is invalid, or too quiet to play.

Boolean HasTag(String tag)

Do we have a tag?

tag
Boolean HasAllTags(String[] tags)

Do we have all the tags on this hitbox?

tags
returns — True if all tags match, false if any tag does not match.
Boolean HasAnyTags(String[] tags)

Do we have all the tags on this hitbox?

tags
returns — True if any tag matches, false if all tags do not match.
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.Surface