Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ROPE_HELPERS_H
  8. #define ROPE_HELPERS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "mathlib/vector.h"
  13. //
  14. // This function can help you choose starting conditions for your rope. It is fairly
  15. // expensive (slightly less than 0.5ms for a 10-node rope), but it's within reason for the
  16. // frequency we create ropes at.
  17. //
  18. // Input:
  19. // - rope endpoints
  20. // - the number of nodes the client will be simulating (CRopeKeyframe::m_nSegments)
  21. // - how low you want the rope to hang (below the lowest of the two endpoints)
  22. //
  23. // Output:
  24. // - pOutputLength = length of the rope
  25. // - pOutputSlack = slack you should set to produce the desired hang
  26. //
  27. void CalcRopeStartingConditions(
  28. const Vector &vStartPos,
  29. const Vector &vEndPos,
  30. int const nNodes,
  31. float const desiredHang,
  32. float *pOutputLength,
  33. float *pOutputSlack
  34. );
  35. #endif // ROPE_HELPERS_H