![]() |
DI-Guy SDK Documentation
13.6
|
chain settings.. Rarely used More...
#include <diguyChainSettings.h>
Public Member Functions | |
General Functions | |
Unless otherwise specified, all functions callable from:
| |
| const char * | get_name () |
| Returns: name of this object; this value will never be NULL. More... | |
| int | set_name (const char *name) |
| This function sets the name of this object. More... | |
Simulation Constants Functions | |
| void | set_num_masses (int num_masses) |
| This function sets how many masses will in a chain using these settings. More... | |
| int | get_num_masses () |
| Returns: number of masses; see set_num_masses() More... | |
| void | set_index_of_chain_mass_connected_to_character (int chain_mass_index) |
| This function sets which chain mass will be connected to the chain's associated character when a chain using these settings is created or reset. More... | |
| int | get_index_of_chain_mass_connected_to_character () |
| Returns: which mass to connect on reset; see set_index_of_chain_mass_connected_to_character() More... | |
| void | set_simulation_dt (float simulation_dt) |
| This function sets the dt of the chain simulation using these settings. More... | |
| float | get_simulation_dt () |
| Returns: dt of chain simulation; see set_simulation_dt() More... | |
| void | set_mass (float mass) |
| This function sets the mass of each chain mass of the chain simulation using these settings. More... | |
| float | get_mass () |
| Returns: mass of each chain mass; see set_mass() More... | |
| void | set_spring_length (float spring_length) |
| This function sets the nominal length of the springs connecting adjacent chain masses of the chain simulation using these settings. More... | |
| float | get_spring_length () |
| Returns: nominal length between adjacent chain masses; see set_spring_length() More... | |
| void | set_spring_k (float spring_k) |
| This function sets the spring constant of the springs connecting adjacent chain masses of the chain simulation using these settings. More... | |
| float | get_spring_k () |
| Returns: spring constant of springs between adjacent masses; see set_spring_k() More... | |
| void | set_spring_b (float spring_b) |
| This function sets the damping constant of the springs connecting adjacent chain masses of the chain simulation using these settings. More... | |
| float | get_spring_b () |
| Returns: damping constant of springs between adjacent masses; see set_spring_b() More... | |
| void | set_neighbor2_spring_length (float neighbor2_spring_length) |
| This function sets the nominal length of the springs connecting '2nd neighbor' chain masses of the chain simulation using these settings. More... | |
| float | get_neighbor2_spring_length () |
| Returns: nominal distance between each mass and its '2nd neighbor'; see set_neighbor2_spring_length() More... | |
| void | set_neighbor2_spring_k (float neighbor2_spring_k) |
| This function sets the spring constant of springs connecting 2nd neighbor chain masses of the chain simulation using these settings. More... | |
| float | get_neighbor2_spring_k () |
| Returns: spring constant of springs between 2nd neighbor masses; see set_neighbor2_spring_k() More... | |
| void | set_neighbor2_spring_b (float neighbor2_spring_b) |
| This function sets the damping constant of springs connecting 2nd neighbor chain masses of the chain simulation using these settings. More... | |
| float | get_neighbor2_spring_b () |
| Returns: damping constant of springs between 2nd neighbor masses; see set_neighbor2_spring_b() More... | |
| void | set_ground_k (float ground_k) |
| This function sets the spring constant of the ground model. More... | |
| float | get_ground_k () |
| Returns: spring constant of ground model; see set_ground_k() More... | |
| void | set_ground_b (float ground_b) |
| This function sets the damping constant of the ground model. More... | |
| float | get_ground_b () |
| Returns: vertical damping constant of ground model; see set_ground_b() More... | |
| void | set_ground_lateral_b (float ground_lateral_b) |
| This function sets how much the ground model slows down masses that are sliding on it. More... | |
| float | get_ground_lateral_b () |
| Returns: lateral damping constant of ground model; see set_ground_lateral_b() More... | |
| void | set_ground_stiction_engage_vel (float ground_stiction_engage_vel) |
| This function sets how slow a mass in contact with the ground must go in order for the mass to stop moving and "stick" to the ground. More... | |
| float | get_ground_stiction_engage_vel () |
| Returns: velocity at stiction will engage; see set_ground_stiction_engage_vel() More... | |
| void | set_ground_stiction_release_force (float ground_stiction_release_force) |
| This function sets how much force is required to cause a mass that has stuck to the ground because of stiction to be released. More... | |
| float | get_ground_stiction_release_force () |
| Returns: force at which masses will release from stiction; see set_ground_stiction_release_force() More... | |
| void | set_ground_height (float ground_height) |
| This function sets the height of the ground model. More... | |
| float | get_ground_height () |
| Returns: height of the ground model; see set_ground_height() More... | |
| void | set_air_b (float air_b) |
| This function sets the damping constant caused by air resistance. More... | |
| float | get_air_b () |
| Returns: damping constant of air; see set_air_b() More... | |
| void | set_gravity (float x, float y, float z) |
| This function sets how strongly link masses will be accelerated in the gravity direction, typically downward. More... | |
| void | get_gravity (float *x, float *y, float *z) |
| Returns: x, y, and z components of gravity; see set_gravity() More... | |
Chain Visual Functions | |
| void | set_radius (float radius) |
| This function sets the radius of the chain visual. More... | |
| float | get_radius () |
| Returns: radius of chain visual; see set_radius() More... | |
| void | set_ambient_color (float r, float g, float b, float a) |
| This function sets the ambient color of the chain visual. More... | |
| void | get_ambient_color (float *r, float *g, float *b, float *a) |
| This function gets the ambient color of the chain visual. More... | |
| void | set_diffuse_color (float r, float g, float b, float a) |
| This function sets the diffuse color of the chain visual. More... | |
| void | get_diffuse_color (float *r, float *g, float *b, float *a) |
| This function gets the diffuse color of the chain visual. More... | |
| void | set_specular_color (float r, float g, float b, float a) |
| This function sets the specular color of the chain visual. More... | |
| void | get_specular_color (float *r, float *g, float *b, float *a) |
| This function gets the specular color of the chain visual. More... | |
| void | set_shininess (float shininess) |
| This function sets the shininess of the chain visual. More... | |
| float | get_shininess () |
| Returns: the shininess of the chain visual; see set_shininess() More... | |
| void | set_texture_filename (const char *texture_filename) |
| This function sets the filename of the texture that will be used for the chain visual. More... | |
| const char * | get_texture_filename () |
| Returns: filename of texture of chain visual; see set_texture_filename() More... | |
| void | set_num_texture_repetitions (int num_texture_repetitions) |
| This function sets how many times the texture will be repeated along the length of the chain. More... | |
| int | get_num_texture_repetitions () |
| Returns: how many times texture will be repeated on chain visual; see set_num_texture_repetitions() More... | |
| void | set_cross_section (diguyChainCrossSection cs) |
| This function sets what the "cross section" of the chain visual will be. More... | |
| diguyChainCrossSection | get_cross_section () |
| Returns: cross section type of chain visual; see set_cross_section() More... | |
| void | set_appearance_begin_cap (const char *appearance_begin_cap) |
| Set the shape that will be attached to the beginning end of the chain. More... | |
| const char * | get_appearance_begin_cap () |
| Returns: name of cap appearance at beginning of chain; see set_appearance_begin_cap() More... | |
| void | set_appearance_end_cap (const char *appearance_end_cap) |
| Sets the shape that will be attached to the end of the chain. More... | |
| const char * | get_appearance_end_cap () |
| Returns: name of cap appearance at end of chain; see set_appearance_end_cap() More... | |
Coil-Specific Functions | |
| void | set_num_coils (int num_coils) |
| For chains with the DIGUY_CHAIN_CROSS_SECTION_COIL cross section, sets the number of coil windings of the chain. More... | |
| int | get_num_coils () |
| Returns: number of coils for chain visual of type DIGUY_CHAIN_CROSS_SECTION_COIL; see set_num_coils() More... | |
| void | set_coil_thickness (float coil_thickness) |
| Sets how thick the coil will be. More... | |
| float | get_coil_thickness () |
| Returns: thickness of coils for chain visual of type DIGUY_CHAIN_CROSS_SECTION_COIL; see set_coil_thickness() More... | |
| void | set_coil_taper_begin_mass_count (int coil_taper_begin_mass_count) |
| Sets at which mass in the coil the thickness of the coil will reach its full radius. More... | |
| int | get_coil_taper_begin_mass_count () |
| Returns: mass at which the coil will reach its full radius at the beginning of chain; see set_coil_taper_begin_mass_count() More... | |
| void | set_coil_taper_end_mass_count (int coil_taper_end_mass_count) |
| Similar to set_coil_taper_begin_mass_count(), but for the end of the chain. More... | |
| int | get_coil_taper_end_mass_count () |
| Returns: mass at which the coil will reach its full radius at end of chain; see set_coil_taper_end_mass_count() More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiScenarioChainSettings * | m_scripted_object |
| A pointer to internal data. More... | |
| class | bdiScenarioChainSettings |
| bdiScenarioChainSettings * | get_scripted_object () |
| diguyChainSettings (bdiScenarioChainSettings *scripted_object) | |
| A private constructor. More... | |
| ~diguyChainSettings () | |
| A private destructor. More... | |
chain settings.. Rarely used
|
private |
A private constructor.
|
private |
A private destructor.
| const char* diguyChainSettings::get_name | ( | ) |
Returns: name of this object; this value will never be NULL.
| int diguyChainSettings::set_name | ( | const char * | name | ) |
This function sets the name of this object.
Returns:
0 on success, -1 on failure
| void diguyChainSettings::set_num_masses | ( | int | num_masses | ) |
This function sets how many masses will in a chain using these settings.
The default is 80 masses.
| num_masses | number of masses |
| int diguyChainSettings::get_num_masses | ( | ) |
Returns: number of masses; see set_num_masses()
| void diguyChainSettings::set_index_of_chain_mass_connected_to_character | ( | int | chain_mass_index | ) |
This function sets which chain mass will be connected to the chain's associated character when a chain using these settings is created or reset.
Pass -1 for no mass to be connected.
The default is chain mass 0.
| chain_mass_index | index of chain mass |
| int diguyChainSettings::get_index_of_chain_mass_connected_to_character | ( | ) |
Returns: which mass to connect on reset; see set_index_of_chain_mass_connected_to_character()
| void diguyChainSettings::set_simulation_dt | ( | float | simulation_dt | ) |
This function sets the dt of the chain simulation using these settings.
Higher dt values will provide faster simulations at the risk of instabilities. Conversely, lower dt values result in more simulation computational overhead, but the simulation will be more stable.
The default is 0.002 seconds.
| simulation_dt | dt of each simulation time step, in seconds |
| float diguyChainSettings::get_simulation_dt | ( | ) |
Returns: dt of chain simulation; see set_simulation_dt()
| void diguyChainSettings::set_mass | ( | float | mass | ) |
This function sets the mass of each chain mass of the chain simulation using these settings.
Heavier mass will result in chain masses that have more momentum when moving.
The default is 0.5 kg.
| mass | mass of each chain mass, in kg |
| float diguyChainSettings::get_mass | ( | ) |
Returns: mass of each chain mass; see set_mass()
| void diguyChainSettings::set_spring_length | ( | float | spring_length | ) |
This function sets the nominal length of the springs connecting adjacent chain masses of the chain simulation using these settings.
Adjacent chain masses will try to keep this distance between them. A longer spring length will result in a longer chain.
The default is 0.2 meters
| spring_length | nominal length between adjacent chain masses, in meters |
| float diguyChainSettings::get_spring_length | ( | ) |
Returns: nominal length between adjacent chain masses; see set_spring_length()
| void diguyChainSettings::set_spring_k | ( | float | spring_k | ) |
This function sets the spring constant of the springs connecting adjacent chain masses of the chain simulation using these settings.
A higher spring constant will result in a more rigid chain, as adjacent masses will try to maintain their nominal spring length between them, as set by set_spring_length().
A hose would have a high spring constant, while a "slinky" would have a low spring constant.
This spring constant only applies between adjacent masses.
The default is 10000.
| spring_k | spring constant of springs between adjacent masses |
| float diguyChainSettings::get_spring_k | ( | ) |
Returns: spring constant of springs between adjacent masses; see set_spring_k()
| void diguyChainSettings::set_spring_b | ( | float | spring_b | ) |
This function sets the damping constant of the springs connecting adjacent chain masses of the chain simulation using these settings.
A higher damping constant will result in a chain that doesn't oscillate as much; movement between masses will quickly die down.
A hose would have a high damping constant, while a "slinky" would have a low damping constant.
The default is 15.
damping constant of springs between adjacent masses
| float diguyChainSettings::get_spring_b | ( | ) |
Returns: damping constant of springs between adjacent masses; see set_spring_b()
| void diguyChainSettings::set_neighbor2_spring_length | ( | float | neighbor2_spring_length | ) |
This function sets the nominal length of the springs connecting '2nd neighbor' chain masses of the chain simulation using these settings.
2nd neighbor chain masses are two masses apart instead of one. (Adjacent masses are one mass apart.)
A longer 2nd neighbor spring length will result in a chain that is stiffer and doesn't droop. A lower value will result in a chain that can droop a lot from mass to mass.
A garden hose would have a high 2nd neighbor spring length, while a metal chain made of linked chain links would have a low 2nd neighbor spring length.
The default is 0.8 meters
| spring_length | nominal length between adjacent chain masses, in meters |
| float diguyChainSettings::get_neighbor2_spring_length | ( | ) |
Returns: nominal distance between each mass and its '2nd neighbor'; see set_neighbor2_spring_length()
| void diguyChainSettings::set_neighbor2_spring_k | ( | float | neighbor2_spring_k | ) |
This function sets the spring constant of springs connecting 2nd neighbor chain masses of the chain simulation using these settings.
See set_spring_k() for a discussion of what this value means.
The default is 600.
| neighbor2_spring_k | spring constant of springs between 2nd neighbor masses |
| float diguyChainSettings::get_neighbor2_spring_k | ( | ) |
Returns: spring constant of springs between 2nd neighbor masses; see set_neighbor2_spring_k()
| void diguyChainSettings::set_neighbor2_spring_b | ( | float | neighbor2_spring_b | ) |
This function sets the damping constant of springs connecting 2nd neighbor chain masses of the chain simulation using these settings.
See set_spring_b() for a discussion of what this value means.
The default is 5.
| neighbor2_spring_b | damping constant of springs between 2nd neighbor masses |
| float diguyChainSettings::get_neighbor2_spring_b | ( | ) |
Returns: damping constant of springs between 2nd neighbor masses; see set_neighbor2_spring_b()
| void diguyChainSettings::set_ground_k | ( | float | ground_k | ) |
This function sets the spring constant of the ground model.
A higher spring constant will result in a harder ground that bounces chain masses higher when they come in contact with the ground. Also, chain masses will not sink as far into the ground when they come to rest.
A tile floor would have a high spring constant, while a mattress would have a low spring constant.
The default is 5000.
| ground_k | spring constant of ground model |
| float diguyChainSettings::get_ground_k | ( | ) |
Returns: spring constant of ground model; see set_ground_k()
| void diguyChainSettings::set_ground_b | ( | float | ground_b | ) |
This function sets the damping constant of the ground model.
A higher damping constant will result in a ground that absorbs impacts and doesn't bounce masses as much when they hit the ground.
A tile floor would have a low damping constant, while an exercise mat would have a high damping constant.
The default is 100.
| ground_b | vertical damping constant of ground model |
| float diguyChainSettings::get_ground_b | ( | ) |
Returns: vertical damping constant of ground model; see set_ground_b()
| void diguyChainSettings::set_ground_lateral_b | ( | float | ground_lateral_b | ) |
This function sets how much the ground model slows down masses that are sliding on it.
A higher lateral damping constant will quickly slow down masses sliding along the ground.
Dirt or grass ground would have a high lateral damping constant. Ice would have a very low damping constant.
The default is 0.5.
| ground_lateral_b | lateral damping constant of ground model |
| float diguyChainSettings::get_ground_lateral_b | ( | ) |
Returns: lateral damping constant of ground model; see set_ground_lateral_b()
| void diguyChainSettings::set_ground_stiction_engage_vel | ( | float | ground_stiction_engage_vel | ) |
This function sets how slow a mass in contact with the ground must go in order for the mass to stop moving and "stick" to the ground.
This is a simple form of "stiction".
A mass will unstick if the force being applied to it exceeds the stiction release force as set by set_ground_stiction_release_force().
The default is 0.05 m/s.
| ground_stiction_engage_vel | velocity at stiction will engage |
| float diguyChainSettings::get_ground_stiction_engage_vel | ( | ) |
Returns: velocity at stiction will engage; see set_ground_stiction_engage_vel()
| void diguyChainSettings::set_ground_stiction_release_force | ( | float | ground_stiction_release_force | ) |
This function sets how much force is required to cause a mass that has stuck to the ground because of stiction to be released.
The default is 10 newtons.
| ground_stiction_release_force | force at which masses will release from stiction |
| float diguyChainSettings::get_ground_stiction_release_force | ( | ) |
Returns: force at which masses will release from stiction; see set_ground_stiction_release_force()
| void diguyChainSettings::set_ground_height | ( | float | ground_height | ) |
This function sets the height of the ground model.
Chain masses below this height will be repelled upward based on their mass and the ground spring and damping constants.
Currently the ground is a level plane.
The default is 0 meters.
| ground_height | height of the ground model, in meters |
| float diguyChainSettings::get_ground_height | ( | ) |
Returns: height of the ground model; see set_ground_height()
| void diguyChainSettings::set_air_b | ( | float | air_b | ) |
This function sets the damping constant caused by air resistance.
A higher air damping constant will result in chains that don't swing as much. A low air damping constant will result in chains that swing freely for a long time.
Water would have a very high "air" damping constant. A clock pendulum would have a very low air damping constant.
The default is 0.1.
| air_b | damping constant of air, or air resistance |
| float diguyChainSettings::get_air_b | ( | ) |
Returns: damping constant of air; see set_air_b()
| void diguyChainSettings::set_gravity | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
This function sets how strongly link masses will be accelerated in the gravity direction, typically downward.
The default is (0, 0, -9.8), in meters per second squared.
| x,y,z | accelerations due to gravity |
| void diguyChainSettings::get_gravity | ( | float * | x, |
| float * | y, | ||
| float * | z | ||
| ) |
Returns: x, y, and z components of gravity; see set_gravity()
| void diguyChainSettings::set_radius | ( | float | radius | ) |
This function sets the radius of the chain visual.
The default is 0.05 meters.
| radius | radius of chain visual, in meters |
| float diguyChainSettings::get_radius | ( | ) |
Returns: radius of chain visual; see set_radius()
| void diguyChainSettings::set_ambient_color | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a | ||
| ) |
This function sets the ambient color of the chain visual.
Passed values should be between 0 and 1.
The default values are (0.4, 0.4, 0.4, 1).
| r,g,b,a | red, green, blue, and alpha components |
| void diguyChainSettings::get_ambient_color | ( | float * | r, |
| float * | g, | ||
| float * | b, | ||
| float * | a | ||
| ) |
This function gets the ambient color of the chain visual.
Values are returned via the passed pointers.
| r,g,b,a | red, green, blue, and alpha components |
| void diguyChainSettings::set_diffuse_color | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a | ||
| ) |
This function sets the diffuse color of the chain visual.
Passed values should be between 0 and 1.
The default values are (1, 1, 1, 1).
| r,g,b,a | red, green, blue, and alpha components |
| void diguyChainSettings::get_diffuse_color | ( | float * | r, |
| float * | g, | ||
| float * | b, | ||
| float * | a | ||
| ) |
This function gets the diffuse color of the chain visual.
Values are returned via the passed pointers.
| r,g,b,a | red, green, blue, and alpha components |
| void diguyChainSettings::set_specular_color | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a | ||
| ) |
This function sets the specular color of the chain visual.
Passed values should be between 0 and 1.
The default values are (1, 1, 1, 1).
| r,g,b,a | red, green, blue, and alpha components |
| void diguyChainSettings::get_specular_color | ( | float * | r, |
| float * | g, | ||
| float * | b, | ||
| float * | a | ||
| ) |
This function gets the specular color of the chain visual.
Values are returned via the passed pointers.
| r,g,b,a | red, green, blue, and alpha components |
| void diguyChainSettings::set_shininess | ( | float | shininess | ) |
This function sets the shininess of the chain visual.
The default is 20.
| shininess | the shininess of the chain visual |
| float diguyChainSettings::get_shininess | ( | ) |
Returns: the shininess of the chain visual; see set_shininess()
| void diguyChainSettings::set_texture_filename | ( | const char * | texture_filename | ) |
This function sets the filename of the texture that will be used for the chain visual.
Common textures are:
"firefighter_hose2.rgb"
The default is "" (no texture).
| texture_filename | filename of texture of chain visual |
| const char* diguyChainSettings::get_texture_filename | ( | ) |
Returns: filename of texture of chain visual; see set_texture_filename()
| void diguyChainSettings::set_num_texture_repetitions | ( | int | num_texture_repetitions | ) |
This function sets how many times the texture will be repeated along the length of the chain.
The default is 1 rep.
| num_texture_repetitions | how many times texture will be repeated on chain visual |
| int diguyChainSettings::get_num_texture_repetitions | ( | ) |
Returns: how many times texture will be repeated on chain visual; see set_num_texture_repetitions()
| void diguyChainSettings::set_cross_section | ( | diguyChainCrossSection | cs | ) |
This function sets what the "cross section" of the chain visual will be.
See the documentation for diguyChainCrossSection for information on what the different cross sections mean.
The default is DIGUY_CHAIN_CROSS_SECTION_SQUARE.
| cs | cross section of the chain visual |
| diguyChainCrossSection diguyChainSettings::get_cross_section | ( | ) |
Returns: cross section type of chain visual; see set_cross_section()
| void diguyChainSettings::set_appearance_begin_cap | ( | const char * | appearance_begin_cap | ) |
Set the shape that will be attached to the beginning end of the chain.
Options are:
"chain_cap_chain_hook"
The default is "" (no begin cap).
| appearance_begin_cap | name of begin cap |
| const char* diguyChainSettings::get_appearance_begin_cap | ( | ) |
Returns: name of cap appearance at beginning of chain; see set_appearance_begin_cap()
| void diguyChainSettings::set_appearance_end_cap | ( | const char * | appearance_end_cap | ) |
Sets the shape that will be attached to the end of the chain.
See set_appearance_begin_cap().
The default is "" (no end cap).
| appearance_end_cap | name of end cap |
| const char* diguyChainSettings::get_appearance_end_cap | ( | ) |
Returns: name of cap appearance at end of chain; see set_appearance_end_cap()
| void diguyChainSettings::set_num_coils | ( | int | num_coils | ) |
For chains with the DIGUY_CHAIN_CROSS_SECTION_COIL cross section, sets the number of coil windings of the chain.
The default is 4 coils.
| num_coils | number of coil windings |
| int diguyChainSettings::get_num_coils | ( | ) |
Returns: number of coils for chain visual of type DIGUY_CHAIN_CROSS_SECTION_COIL; see set_num_coils()
| void diguyChainSettings::set_coil_thickness | ( | float | coil_thickness | ) |
Sets how thick the coil will be.
The default is 0.02 meters.
| coil_thickness | thickness of coil |
| float diguyChainSettings::get_coil_thickness | ( | ) |
Returns: thickness of coils for chain visual of type DIGUY_CHAIN_CROSS_SECTION_COIL; see set_coil_thickness()
| void diguyChainSettings::set_coil_taper_begin_mass_count | ( | int | coil_taper_begin_mass_count | ) |
Sets at which mass in the coil the thickness of the coil will reach its full radius.
The default is 6.
| coil_taper_begin_mass_count | chain mass at which to begin taper |
| int diguyChainSettings::get_coil_taper_begin_mass_count | ( | ) |
Returns: mass at which the coil will reach its full radius at the beginning of chain; see set_coil_taper_begin_mass_count()
| void diguyChainSettings::set_coil_taper_end_mass_count | ( | int | coil_taper_end_mass_count | ) |
Similar to set_coil_taper_begin_mass_count(), but for the end of the chain.
The default is 0.
| coil_taper_end_mass_count | chain mass at which to end taper |
| int diguyChainSettings::get_coil_taper_end_mass_count | ( | ) |
Returns: mass at which the coil will reach its full radius at end of chain; see set_coil_taper_end_mass_count()
|
inline |
|
friend |
|
private |
A pointer to internal data.