Description
The Elasticity
property of the Surface
class in the Sandbox namespace is a float
value that controls the bounciness of the surface. It is a public instance property, meaning it can be accessed and modified on instances of the Surface
class. The elasticity value ranges from 0 to 1, where 0 represents no bounciness and 1 represents maximum bounciness.
Usage
To use the Elasticity
property, you can get or set its value on a Surface
object. This property is useful for defining how much an object will bounce when it collides with the surface.
Ensure that the value assigned to Elasticity
is within the specified range (0 to 1) to avoid unexpected behavior.
Example
// Example of setting the Elasticity property
Surface mySurface = new Surface();
mySurface.Elasticity = 0.75f; // Sets the elasticity to 75% bounciness
// Example of getting the Elasticity property
float currentElasticity = mySurface.Elasticity;
// Use currentElasticity for further calculations or logic