Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 27, 2011, 7:43:24 AM (14 years ago)
Author:
rgrieder
Message:

Updated Bullet Physics Engine from v2.74 to v2.77

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/external/bullet/BulletCollision/CollisionShapes/btCylinderShape.cpp

    r5781 r7983  
    11/*
    22Bullet Continuous Collision Detection and Physics Library
    3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
     3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
    44
    55This software is provided 'as-is', without any express or implied warranty.
     
    13133. This notice may not be removed or altered from any source distribution.
    1414*/
     15
    1516#include "btCylinderShape.h"
    1617
    1718btCylinderShape::btCylinderShape (const btVector3& halfExtents)
    18 :btBoxShape(halfExtents),
     19:btConvexInternalShape(),
    1920m_upAxis(1)
    2021{
     22        btVector3 margin(getMargin(),getMargin(),getMargin());
     23        m_implicitShapeDimensions = (halfExtents * m_localScaling) - margin;
    2124        m_shapeType = CYLINDER_SHAPE_PROXYTYPE;
    22         recalcLocalAabb();
    2325}
    2426
     
    2830{
    2931        m_upAxis = 0;
    30         recalcLocalAabb();
     32
    3133}
    3234
     
    3638{
    3739        m_upAxis = 2;
    38         recalcLocalAabb();
     40
    3941}
    4042
    4143void btCylinderShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
    4244{
    43         //skip the box 'getAabb'
    44         btPolyhedralConvexShape::getAabb(t,aabbMin,aabbMax);
     45        btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
     46}
     47
     48void    btCylinderShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
     49{
     50        //approximation of box shape, todo: implement cylinder shape inertia before people notice ;-)
     51        btVector3 halfExtents = getHalfExtentsWithMargin();
     52
     53        btScalar lx=btScalar(2.)*(halfExtents.x());
     54        btScalar ly=btScalar(2.)*(halfExtents.y());
     55        btScalar lz=btScalar(2.)*(halfExtents.z());
     56
     57        inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
     58                                        mass/(btScalar(12.0)) * (lx*lx + lz*lz),
     59                                        mass/(btScalar(12.0)) * (lx*lx + ly*ly));
     60
    4561}
    4662
Note: See TracChangeset for help on using the changeset viewer.