Physical substance definition, used for collision detection/treatment What we need is mu, slip and kp,kd parameter for the collision Definition of substance parameters: More...
#include <substance.h>
Inherited by DebugSubstance.
Public Member Functions | |
Substance () | |
Substance (float roughness, float slip, float hardness, float elasticity) | |
void | setCollisionCallback (CollisionCallback func, void *userdata) |
void | toDefaultSubstance () |
void | toMetal (float roughness) |
very hard and elastic with slip roughness [0.1-1] | |
void | toRubber (float hardness) |
high roughness, no slip, very elastic, hardness : [5-50] | |
void | toPlastic (float roughness) |
medium slip, a bit elastic, medium hardness, roughness [0.5-2] | |
void | toFoam (float _hardness) |
large slip, not elastic, low hardness [1-30], high roughness | |
void | toSnow (float _slip) |
variable slip and roughness, not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0 | |
void | toNoContact () |
set the collsion callback to ignores everything Usually it is better to use the "ignorePairs" from odeHandle but if this particular one substance should not collide with any other, this is easier. | |
void | toAnisotropFriction (double ratio, const Axis &axis) |
enables anisotrop friction. | |
Static Public Member Functions | |
static void | getSurfaceParams (dSurfaceParameters &sp, const Substance &s1, const Substance &s2, double stepsize) |
Combination of two surfaces. | |
static void | printSurfaceParams (const dSurfaceParameters &surfParams) |
static Substance | getDefaultSubstance () |
default substance is plastic with roughness=0.8 | |
static Substance | getMetal (float roughness) |
very hard and elastic with slip roughness [0.1-1] | |
static Substance | getRubber (float hardness) |
high roughness, no slip, very elastic, hardness : [5-50] | |
static Substance | getPlastic (float roughness) |
medium slip, a bit elastic, medium hardness, roughness [0.5-2] | |
static Substance | getFoam (float _hardness) |
large slip, not elastic, low hardness [1-30], high roughness | |
static Substance | getSnow (float _slip) |
variable slip and roughness [0-1], not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0 | |
static Substance | getNoContact () |
Public Attributes | |
float | roughness |
float | slip |
float | hardness |
float | elasticity |
CollisionCallback | callback |
void * | userdata |
Physical substance definition, used for collision detection/treatment What we need is mu, slip and kp,kd parameter for the collision Definition of substance parameters:
Parameter interval collision_parameter roughness: [0-] mu = roughness1*roughness2 slip: [0-] slip = slip1+slip2 hardness: [0-] kp = hardness1 * hardness2 / (hardness1 + hardness2) (two springs serial) elasticity: [0-1] kd = (1-elasticity1) * s2.hardness + (1-elasticity2) * s1.hardness) / (s1.hardness + s2.hardness);
For the calculation of the spring/damping constant we use the following schema: The collision can be considered as 2 springs serially connected. The spring constant of each collision side is given by hardness (here kp). The spring constant of the entire spring is given by
. The damping (kd) is derived from the elasticity (e), but it is more difficult to compute. Consider the damping in form of energy lost. We can write the energy or work done by each spring as:
with
. The energy lost though damping is
. The final damping is now:
.
Note that you cannot add any member variables to derived classes since they do not fit into the substance object in OdeHandle!
Substance | ( | ) |
Substance | ( | float | roughness, | |
float | slip, | |||
float | hardness, | |||
float | elasticity | |||
) |
Substance getDefaultSubstance | ( | ) | [static] |
default substance is plastic with roughness=0.8
Substance getFoam | ( | float | _hardness | ) | [static] |
large slip, not elastic, low hardness [1-30], high roughness
Substance getMetal | ( | float | roughness | ) | [static] |
very hard and elastic with slip roughness [0.1-1]
Substance getNoContact | ( | ) | [static] |
Substance getPlastic | ( | float | roughness | ) | [static] |
medium slip, a bit elastic, medium hardness, roughness [0.5-2]
Substance getRubber | ( | float | hardness | ) | [static] |
high roughness, no slip, very elastic, hardness : [5-50]
Substance getSnow | ( | float | _slip | ) | [static] |
variable slip and roughness [0-1], not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0
void getSurfaceParams | ( | dSurfaceParameters & | sp, | |
const Substance & | s1, | |||
const Substance & | s2, | |||
double | stepsize | |||
) | [static] |
Combination of two surfaces.
void printSurfaceParams | ( | const dSurfaceParameters & | surfParams | ) | [static] |
void setCollisionCallback | ( | CollisionCallback | func, | |
void * | userdata | |||
) |
void toAnisotropFriction | ( | double | ratio, | |
const Axis & | axis | |||
) |
enables anisotrop friction.
The friction along the given axis is ratio fold of the friction in the other directions. If ratio = 0.1 and axis=Axis(0,0,1) then the fiction along the z-axis is 1/10th of the normal friction. Useful to mimic scales of snakes or the like. WARNING: this sets the collisionCallback! To disable the collisionCallback has to set to 0 manually
void toDefaultSubstance | ( | ) |
void toFoam | ( | float | _hardness | ) |
large slip, not elastic, low hardness [1-30], high roughness
void toMetal | ( | float | roughness | ) |
very hard and elastic with slip roughness [0.1-1]
void toNoContact | ( | ) |
set the collsion callback to ignores everything Usually it is better to use the "ignorePairs" from odeHandle but if this particular one substance should not collide with any other, this is easier.
WARNING: this sets the collisionCallback. This will not convert to other substances without manually setting the callback to 0
void toPlastic | ( | float | roughness | ) |
medium slip, a bit elastic, medium hardness, roughness [0.5-2]
void toRubber | ( | float | hardness | ) |
high roughness, no slip, very elastic, hardness : [5-50]
void toSnow | ( | float | _slip | ) |
variable slip and roughness, not elastic, high hardness for solid snow slip = 1 <--> roughness=0.0, slip = 0 <--> roughnes=1.0
float elasticity |
float hardness |
float roughness |
float slip |
void* userdata |