s&box docs

public class Sandbox.Surface : Sandbox.GameResource

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

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

Methods

Showing 11 methods

protected virtual Sandbox.Bitmap CreateAssetTypeIcon(int width, int height)

public static Sandbox.Surface FindByName(string name)

Returns a Surface from its name, or null

Parameters

  • 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

public Sandbox.Surface GetBaseSurface()

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

public bool HasAllTags(string[] tags)

Do we have all the tags on this hitbox?

Returns

True if all tags match, false if any tag does not match.

public bool HasAnyTags(string[] tags)

Do we have all the tags on this hitbox?

Returns

True if any tag matches, false if all tags do not match.

public bool HasTag(string tag)

Do we have a tag?

protected virtual void OnDestroy()

public Sandbox.SoundHandle PlayCollisionSound(Vector3 position, float speed = 320)

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

Parameters

  • speed: Default: 320

protected virtual void PostLoad()

protected virtual void PostReload()

public void SetBaseSurface(string name)

Sets the base surface by name.

Properties

Showing 19 properties

public string Sandbox.Surface.BaseSurface { get; set; }

Filepath of the base surface. Use SetBaseSurface and GetBaseSurface.

public float Sandbox.Surface.BounceThreshold { get; set; }

Velocity threshold, below which objects will not bounce due to their elasticity.

public float Sandbox.Surface.Dampening { get; set; }Obsolete

Obsolete: This API member is obsolete.

public float Sandbox.Surface.Density { get; set; }

Density of this surface material. This affects things like automatic mass calculation. Density is in kg/m^3.

public string Sandbox.Surface.Description { get; set; }

A concise description explaining what this surface property should be used for.

public float Sandbox.Surface.Elasticity { get; set; }

Controls bounciness.

public float Sandbox.Surface.FluidAngularDrag { get; set; }

Angular drag applied when submerged.

public float Sandbox.Surface.FluidLinearDrag { get; set; }

Linear drag applied when submerged.

public float Sandbox.Surface.Friction { get; set; }

Friction of this surface material.

public Sandbox.Surface.ImpactEffectData Sandbox.Surface.ImpactEffects { get; set; }Obsolete

Impact effects of this surface material.

Obsolete: This API member is obsolete.

public int Sandbox.Surface.Index { get; set; }

public uint Sandbox.Surface.NameHash { get; set; }

public float Sandbox.Surface.RollingResistance { get; set; }

Controls how easily rolling shapes (sphere, capsule) roll on surfaces.

public Sandbox.Surface.ScrapeEffectData Sandbox.Surface.ScrapeEffects { get; set; }Obsolete

Scrape effects of this surface material.

Obsolete: This API member is obsolete.

public Sandbox.Surface.OldSoundData Sandbox.Surface.Sounds { get; set; }Obsolete

Sounds associated with this surface material.

Obsolete: This API member is obsolete.

public string Sandbox.Surface.Tags { get; set; }

A list of tags as one string.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Surface

On this page

Constructorspublic Surface()Methodsprotected virtual Sandbox.Bitmap CreateAssetTypeIcon(System.Int32 width, System.Int32 height)public static Sandbox.Surface FindByName(System.String name)public Sandbox.Surface GetBaseSurface()public System.Boolean HasAllTags(System.String[] tags)public System.Boolean HasAnyTags(System.String[] tags)public System.Boolean HasTag(System.String tag)protected virtual System.Void OnDestroy()public Sandbox.SoundHandle PlayCollisionSound(Vector3 position, System.Single speed = 320)protected virtual System.Void PostLoad()protected virtual System.Void PostReload()public System.Void SetBaseSurface(System.String name)Propertiespublic Sandbox.AudioSurface Sandbox.Surface.AudioSurface { get; set; }public System.String Sandbox.Surface.BaseSurface { get; set; }public System.Single Sandbox.Surface.BounceThreshold { get; set; }public System.Single Sandbox.Surface.Dampening { get; set; }public System.Single Sandbox.Surface.Density { get; set; }public System.String Sandbox.Surface.Description { get; set; }public System.Single Sandbox.Surface.Elasticity { get; set; }public System.Single Sandbox.Surface.FluidAngularDrag { get; set; }public System.Single Sandbox.Surface.FluidLinearDrag { get; set; }public System.Single Sandbox.Surface.Friction { get; set; }public Sandbox.Surface.ImpactEffectData Sandbox.Surface.ImpactEffects { get; set; }public System.Int32 Sandbox.Surface.Index { get; set; }public System.UInt32 Sandbox.Surface.NameHash { get; set; }public Sandbox.Surface.SurfacePrefabCollection Sandbox.Surface.PrefabCollection { get; set; }public System.Single Sandbox.Surface.RollingResistance { get; set; }public Sandbox.Surface.ScrapeEffectData Sandbox.Surface.ScrapeEffects { get; set; }public Sandbox.Surface.SurfaceSoundCollection Sandbox.Surface.SoundCollection { get; set; }public Sandbox.Surface.OldSoundData Sandbox.Surface.Sounds { get; set; }public System.String Sandbox.Surface.Tags { get; set; }Metadata