[1963] | 1 | /* |
---|
| 2 | Bullet Continuous Collision Detection and Physics Library |
---|
| 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
| 4 | |
---|
| 5 | This software is provided 'as-is', without any express or implied warranty. |
---|
| 6 | In no event will the authors be held liable for any damages arising from the use of this software. |
---|
| 7 | Permission is granted to anyone to use this software for any purpose, |
---|
| 8 | including commercial applications, and to alter it and redistribute it freely, |
---|
| 9 | subject to the following restrictions: |
---|
| 10 | |
---|
| 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. |
---|
| 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
---|
| 13 | 3. This notice may not be removed or altered from any source distribution. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | #include "btCollisionObject.h" |
---|
| 18 | |
---|
| 19 | btCollisionObject::btCollisionObject() |
---|
[2908] | 20 | : m_broadphaseHandle(0), |
---|
[1963] | 21 | m_collisionShape(0), |
---|
| 22 | m_rootCollisionShape(0), |
---|
| 23 | m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT), |
---|
| 24 | m_islandTag1(-1), |
---|
| 25 | m_companionId(-1), |
---|
| 26 | m_activationState1(1), |
---|
| 27 | m_deactivationTime(btScalar(0.)), |
---|
| 28 | m_friction(btScalar(0.5)), |
---|
| 29 | m_restitution(btScalar(0.)), |
---|
| 30 | m_userObjectPointer(0), |
---|
| 31 | m_internalType(CO_COLLISION_OBJECT), |
---|
| 32 | m_hitFraction(btScalar(1.)), |
---|
| 33 | m_ccdSweptSphereRadius(btScalar(0.)), |
---|
| 34 | m_ccdMotionThreshold(btScalar(0.)), |
---|
| 35 | m_checkCollideWith(false) |
---|
| 36 | { |
---|
| 37 | |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | btCollisionObject::~btCollisionObject() |
---|
| 41 | { |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | void btCollisionObject::setActivationState(int newState) |
---|
| 45 | { |
---|
| 46 | if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION)) |
---|
| 47 | m_activationState1 = newState; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | void btCollisionObject::forceActivationState(int newState) |
---|
| 51 | { |
---|
| 52 | m_activationState1 = newState; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | void btCollisionObject::activate(bool forceActivation) |
---|
| 56 | { |
---|
| 57 | if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT))) |
---|
| 58 | { |
---|
| 59 | setActivationState(ACTIVE_TAG); |
---|
| 60 | m_deactivationTime = btScalar(0.); |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|