diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/rope_helpers.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/shared/rope_helpers.h')
| -rw-r--r-- | game/shared/rope_helpers.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/game/shared/rope_helpers.h b/game/shared/rope_helpers.h new file mode 100644 index 0000000..7a5ad78 --- /dev/null +++ b/game/shared/rope_helpers.h @@ -0,0 +1,42 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef ROPE_HELPERS_H +#define ROPE_HELPERS_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "mathlib/vector.h" + + +// +// This function can help you choose starting conditions for your rope. It is fairly +// expensive (slightly less than 0.5ms for a 10-node rope), but it's within reason for the +// frequency we create ropes at. +// +// Input: +// - rope endpoints +// - the number of nodes the client will be simulating (CRopeKeyframe::m_nSegments) +// - how low you want the rope to hang (below the lowest of the two endpoints) +// +// Output: +// - pOutputLength = length of the rope +// - pOutputSlack = slack you should set to produce the desired hang +// +void CalcRopeStartingConditions( + const Vector &vStartPos, + const Vector &vEndPos, + int const nNodes, + float const desiredHang, + float *pOutputLength, + float *pOutputSlack + ); + + +#endif // ROPE_HELPERS_H |