Back to index

supertuxkart  0.5+dfsg1
btCollisionObject.cpp
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 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.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 
00017 #include "btCollisionObject.h"
00018 
00019 btCollisionObject::btCollisionObject()
00020        :      m_broadphaseHandle(0),
00021               m_collisionShape(0),
00022               m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),
00023               m_islandTag1(-1),
00024               m_companionId(-1),
00025               m_activationState1(1),
00026               m_deactivationTime(btScalar(0.)),
00027               m_friction(btScalar(0.5)),
00028               m_restitution(btScalar(0.)),
00029               m_userObjectPointer(0),
00030               m_internalType(CO_COLLISION_OBJECT),
00031               m_hitFraction(btScalar(1.)),
00032               m_ccdSweptSphereRadius(btScalar(0.)),
00033               m_ccdSquareMotionThreshold(btScalar(0.)),
00034               m_checkCollideWith(false)
00035 {
00036        
00037 }
00038 
00039 btCollisionObject::~btCollisionObject()
00040 {
00041 }
00042 
00043 void btCollisionObject::setActivationState(int newState) 
00044 { 
00045        if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
00046               m_activationState1 = newState;
00047 }
00048 
00049 void btCollisionObject::forceActivationState(int newState)
00050 {
00051        m_activationState1 = newState;
00052 }
00053 
00054 void btCollisionObject::activate(bool forceActivation)
00055 {
00056        if (forceActivation || !(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
00057        {
00058               setActivationState(ACTIVE_TAG);
00059               m_deactivationTime = btScalar(0.);
00060        }
00061 }
00062 
00063 
00064