| 1 | /* |
| 2 | * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
| 5 | * and proprietary rights in and to this software, related documentation |
| 6 | * and any modifications thereto. Any use, reproduction, disclosure or |
| 7 | * distribution of this software and related documentation without an express |
| 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. |
| 9 | */ |
| 10 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
| 11 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
| 12 | |
| 13 | |
| 14 | #ifndef PX_SCALE_H |
| 15 | #define PX_SCALE_H |
| 16 | |
| 17 | /** \addtogroup common |
| 18 | @{ |
| 19 | */ |
| 20 | |
| 21 | #include "common/PxPhysXCommonConfig.h" |
| 22 | |
| 23 | #ifndef PX_DOXYGEN |
| 24 | namespace physx |
| 25 | { |
| 26 | #endif |
| 27 | |
| 28 | class PxPhysics; |
| 29 | |
| 30 | /** |
| 31 | \brief Class to define the scale at which simulation runs. Most simulation tolerances are |
| 32 | calculated in terms of the values here. |
| 33 | |
| 34 | \note if you change the simulation scale, you will probablly also wish to change the scene's |
| 35 | default value of gravity, and stable simulation will probably require changes to the scene's |
| 36 | bounceThreshold also. |
| 37 | */ |
| 38 | |
| 39 | class PxTolerancesScale |
| 40 | { |
| 41 | public: |
| 42 | |
| 43 | /** brief |
| 44 | The approximate size of objects in the simulation. |
| 45 | |
| 46 | For simulating roughly human-sized in metric units, 1 is a good choice. |
| 47 | If simulation is done in centimetres, use 100 instead. This is used to |
| 48 | estimate certain length-related tolerances. |
| 49 | |
| 50 | */ |
| 51 | |
| 52 | PxReal length; |
| 53 | |
| 54 | |
| 55 | /** brief |
| 56 | The approximate mass of a length * length * length block. |
| 57 | If using metric scale for character sized objects and measuring mass in |
| 58 | kilogrammes, 1000 is a good choice. |
| 59 | */ |
| 60 | PxReal mass; |
| 61 | |
| 62 | /** brief |
| 63 | The typical magnitude of velocities of objects in simulation. This is used to estimate |
| 64 | whether a contact should be treated as bouncing or resting based on its impact velocity, |
| 65 | and a kinetic energy threshold below which the simulation may put objects to sleep. |
| 66 | |
| 67 | For normal physical environments, a good choice is the approximate speed of an object falling |
| 68 | under gravity for one second. |
| 69 | */ |
| 70 | PxReal speed; |
| 71 | |
| 72 | |
| 73 | /** |
| 74 | \brief constructor sets to default |
| 75 | */ |
| 76 | PX_INLINE PxTolerancesScale(); |
| 77 | |
| 78 | /** |
| 79 | \brief Returns true if the descriptor is valid. |
| 80 | \return true if the current settings are valid (returns always true). |
| 81 | */ |
| 82 | PX_INLINE bool isValid() const; |
| 83 | |
| 84 | }; |
| 85 | |
| 86 | PX_INLINE PxTolerancesScale::PxTolerancesScale(): |
| 87 | length(1), |
| 88 | mass(1000), |
| 89 | speed(10) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | PX_INLINE bool PxTolerancesScale::isValid() const |
| 94 | { |
| 95 | return length>0 && mass>0; |
| 96 | } |
| 97 | |
| 98 | #ifndef PX_DOXYGEN |
| 99 | } // namespace physx |
| 100 | #endif |
| 101 | |
| 102 | /** @} */ |
| 103 | #endif |
| 104 | |