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() |
---|
20 | : m_anisotropicFriction(1.f,1.f,1.f), |
---|
21 | m_hasAnisotropicFriction(false), |
---|
22 | m_contactProcessingThreshold(1e30f), |
---|
23 | m_broadphaseHandle(0), |
---|
24 | m_collisionShape(0), |
---|
25 | m_rootCollisionShape(0), |
---|
26 | m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT), |
---|
27 | m_islandTag1(-1), |
---|
28 | m_companionId(-1), |
---|
29 | m_activationState1(1), |
---|
30 | m_deactivationTime(btScalar(0.)), |
---|
31 | m_friction(btScalar(0.5)), |
---|
32 | m_restitution(btScalar(0.)), |
---|
33 | m_userObjectPointer(0), |
---|
34 | m_internalType(CO_COLLISION_OBJECT), |
---|
35 | m_hitFraction(btScalar(1.)), |
---|
36 | m_ccdSweptSphereRadius(btScalar(0.)), |
---|
37 | m_ccdMotionThreshold(btScalar(0.)), |
---|
38 | m_checkCollideWith(false) |
---|
39 | { |
---|
40 | |
---|
41 | } |
---|
42 | |
---|
43 | btCollisionObject::~btCollisionObject() |
---|
44 | { |
---|
45 | } |
---|
46 | |
---|
47 | void btCollisionObject::setActivationState(int newState) |
---|
48 | { |
---|
49 | if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION)) |
---|
50 | m_activationState1 = newState; |
---|
51 | } |
---|
52 | |
---|
53 | void btCollisionObject::forceActivationState(int newState) |
---|
54 | { |
---|
55 | m_activationState1 = newState; |
---|
56 | } |
---|
57 | |
---|
58 | void btCollisionObject::activate(bool forceActivation) |
---|
59 | { |
---|
60 | if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT))) |
---|
61 | { |
---|
62 | setActivationState(ACTIVE_TAG); |
---|
63 | m_deactivationTime = btScalar(0.); |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | |
---|