![]() |
C++ SDK Reference
12.5
|
#include <diguyChainSimulation.h>
Public Member Functions | |
| diguyChainSettings * | get_settings () |
| This function returns the chain settings this chain simulation is using. More... | |
| int | update_settings (const char *settings) |
| This function sets the settings this chain simulation will use. More... | |
| int | do_stabilization_time_runoff (float time_runoff) |
| This function runs the simulation forward the specified number of seconds, to let the chain settle into a stable configuration. More... | |
| void | set_is_frozen (int is_frozen) |
| This function can 'freeze' or 'unfreeze' a chain. More... | |
| int | get_is_frozen () |
| Returns: 1 if chain is frozen, 0 if not. More... | |
| int | set_chain_mass_connection_character (int chain_mass_index, const char *character_name, const char *link_name=NULL, float link_offset_x=0.0f, float link_offset_y=0.0f, float link_offset_z=0.0f, float connection_smoothing_period=0.1f) |
| This function connects a chain mass to a character, or disconnects a chain mass if the passed character_name is NULL. More... | |
| int | set_chain_mass_position (int chain_mass_index, float mass_x, float mass_y, float mass_z, int fix_mass_position) |
| This function sets the position of one chain mass, and optionally fixes it there. More... | |
| int | set_chain_mass_positions_along_path_shape (diguyPathShape *path_shape, int stretch_to_fit=1) |
| This function sets the positions of all chain masses to lie along the passed path shape. More... | |
| int | set_chain_mass_position_is_fixed (int chain_mass_index, int is_fixed) |
| This function can fix or unfix a chain mass in place. More... | |
| int | get_chain_mass_position_is_fixed (int mass_index) |
| Returns: 1 if chain mass is fixed, 0 if not. More... | |
| float | get_length () |
| Returns: length of the chain. More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiScenarioChain * | m_scripted_object |
| A pointer to internal data. More... | |
| class | bdiScenarioChain |
| bdiScenarioChain * | get_scripted_object () |
| diguyChainSimulation (bdiScenarioChain *scripted_object) | |
| A private constructor. More... | |
| ~diguyChainSimulation () | |
| A private destructor. More... | |
|
private |
A private constructor.
|
private |
A private destructor.
| diguyChainSettings* diguyChainSimulation::get_settings | ( | ) |
This function returns the chain settings this chain simulation is using.
Returns:
object of type diguyChainSettings; will never be NULL
Callable From:
| int diguyChainSimulation::update_settings | ( | const char * | settings | ) |
This function sets the settings this chain simulation will use.
| settings | name of new settings to use |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyChainSimulation::do_stabilization_time_runoff | ( | float | time_runoff | ) |
This function runs the simulation forward the specified number of seconds, to let the chain settle into a stable configuration.
Note that the chain will appear to achieve the new configuration instantly.
Specifying a large amount of time can result in a frame rate hitch.
| time_runoff | how much time to run off, in seconds |
Returns:
0 on success, -1 on failure
Callable From:
| void diguyChainSimulation::set_is_frozen | ( | int | is_frozen | ) |
This function can 'freeze' or 'unfreeze' a chain.
If a chain is frozen, all chain masses will remain in their current positions and will not move until the chain is unfrozen.
A frozen chain requires no simulation time.
| is_frozen | pass 1 to freeze the chain; 0 to unfreeze |
Callable From:
| int diguyChainSimulation::get_is_frozen | ( | ) |
Returns: 1 if chain is frozen, 0 if not.
Callable From:
| int diguyChainSimulation::set_chain_mass_connection_character | ( | int | chain_mass_index, |
| const char * | character_name, | ||
| const char * | link_name = NULL, |
||
| float | link_offset_x = 0.0f, |
||
| float | link_offset_y = 0.0f, |
||
| float | link_offset_z = 0.0f, |
||
| float | connection_smoothing_period = 0.1f |
||
| ) |
This function connects a chain mass to a character, or disconnects a chain mass if the passed character_name is NULL.
As the character moves the chain mass will move with it, dragging adjacent masses along. This allows a firefighter to pick up one end of a hose and drag the hose to a new location, for example.
In each time-step of the scenario a new position for the specified chain mass will be computed based on the position of the character.
When the chain sim is created, and when the scenario is reset, one chain mass will be automatically connected to the chain's character. The index of the mass that will be connected is set by a call to diguyChainSettings::set_index_of_chain_mass_connected_to_character().
Chain masses can be connected to a specific link of the connection character by passing the link's name. If NULL is passed, the connection will be made to the character's "position" link. Note that a non-NULL link name must be used for the link offset arguments to have an effect.
The chain mass can gradually be shifted from its current position to the connection position using the connection_smoothing_period argument. Passing in 0.5, for example, will cause the link to shift to its new connection point within approximately 0.5 seconds, avoiding an abrupt and potentially ugly impulse to the simulation.
| chain_mass_index | index of chain mass |
| character_name | name of character to attach to; must not be NULL |
| link_name | name of link to attach to; can be NULL; if so, will attach to character's base position |
| link_offset_x | link attachment offset in X |
| link_offset_y | link attachment offset in Y |
| link_offset_z | link attachment offset in Z |
| connection_smoothing_period | how much time to take, in seconds, to gradually shift the chain mass to its new connection point |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyChainSimulation::set_chain_mass_position | ( | int | chain_mass_index, |
| float | mass_x, | ||
| float | mass_y, | ||
| float | mass_z, | ||
| int | fix_mass_position | ||
| ) |
This function sets the position of one chain mass, and optionally fixes it there.
The passed position is always relative to the chain character's parent, if there is one.
If the fix_mass_position argument is 1, the chain mass will remain fixed in the new position, as if set_chain_mass_position_is_fixed(1) were called.
| chain_mass_index | index of chain mass; pass -1 to affect all chain masses |
| mass_x | position x |
| mass_y | position y |
| mass_z | position z |
| fix_mass_position | pass 1 to fix chain mass in place; 0 to leave it free to move |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyChainSimulation::set_chain_mass_positions_along_path_shape | ( | diguyPathShape * | path_shape, |
| int | stretch_to_fit = 1 |
||
| ) |
This function sets the positions of all chain masses to lie along the passed path shape.
If the stretch_to_fit argument is 1, chain masses will be spaced along the entire length of the path shape. If the path shape is longer than the nominal length of the chain, the chain will be stretched out. If the path shape is shorter, the chain will be compressed.
| path_shape | path shape for new chain mass positions |
| stretch_to_fit | pass 1 to stretch chain to take up entire length of path_shape; pass 0 to leave chain at its nominal length |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyChainSimulation::set_chain_mass_position_is_fixed | ( | int | chain_mass_index, |
| int | is_fixed | ||
| ) |
This function can fix or unfix a chain mass in place.
If it is fixed the chain mass will remain in its current position until it is unfixed.
Fixed chain masses do not require simulation time, so the more masses in a chain that are fixed, the lower the computational load of the chain simulation.
| chain_mass_index | index of chain mass; pass -1 to affect all chain masses |
| is_fixed | pass 1 to fix chain mass position; 0 to unfix it |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyChainSimulation::get_chain_mass_position_is_fixed | ( | int | mass_index | ) |
Returns: 1 if chain mass is fixed, 0 if not.
Callable From:
| float diguyChainSimulation::get_length | ( | ) |
Returns: length of the chain.
Callable From:
|
inline |
|
friend |
|
private |
A pointer to internal data.