public class Sandbox.Surface : Sandbox.GameResource
A physics surface. This is applied to each PhysicsShape and controls its physical properties and physics related sounds.
Related Guides
Broader workflow and conceptual references connected to this API.
The Material API is a structure to define the surface properties of what you're drawing as described by traditional PBR shading models.
You can record gameplay into a MovieClip, which can be played back or imported into Movie Maker for editing. This could be useful for killcams in shooters, leaderboard replays in racing games, or for capturing gameplay to edit into a trailer.
The Clutter System lets you quickly scatter large amounts of small objects like grass, rocks, and debris across your scene. It handles placement, streaming, and GPU-instanced rendering for models automatically.
We have some utility functions for reading from the depth buffer. We generate it in an early depth pass, so you can re-use this even on operations that also write to depth.
If you want to access lighting information directly you can use this.
S&box includes a full 3D and 2D physics system powered by the Source 2 engine, with great performance and stability. Rigidbodies, colliders, joints, raycasting, and trigger volumes are all usable through Components on GameObjects.
Constructors
Showing 1 constructors
public Surface()
No results match this filter.
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.
No results match this filter.
Properties
Showing 19 properties
public Sandbox.AudioSurface Sandbox.Surface.AudioSurface { get; set; }
Defines the audio properties of this surface for Steam Audio
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 Sandbox.Surface.SurfacePrefabCollection Sandbox.Surface.PrefabCollection { get; set; }
Common prefabs for this surface material
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.SurfaceSoundCollection Sandbox.Surface.SoundCollection { get; set; }
Sounds for this surface material
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.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.Surface |