| [1985] | 1 | /*************************************************************************** |
|---|
| 2 | |
|---|
| 3 | This source file is part of OGREBULLET |
|---|
| 4 | (Object-oriented Graphics Rendering Engine Bullet Wrapper) For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10 |
|---|
| 5 | |
|---|
| 6 | Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes) |
|---|
| 7 | |
|---|
| 8 | file added by rtti (at) elane2k (dot) com |
|---|
| 9 | |
|---|
| 10 | This program is free software; you can redistribute it and/or modify it under the terms of the GPL General Public License with runtime exception as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL General Public License with runtime exception for more details. |
|---|
| 13 | |
|---|
| 14 | You should have received a copy of the GPL General Public License with runtime exception along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 15 | ---------------------------------------------------------------------------- |
|---|
| 16 | - |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | #include "OgreBulletDynamics.h" |
|---|
| 20 | |
|---|
| 21 | #include "OgreBulletDynamicsWorld.h" |
|---|
| 22 | #include "OgreBulletDynamicsRigidBody.h" |
|---|
| 23 | |
|---|
| 24 | #include "OgreBulletDynamicsConstraint.h" |
|---|
| 25 | #include "Constraints/OgreBulletDynamicsConeTwistConstraint.h" |
|---|
| 26 | |
|---|
| 27 | using namespace Ogre; |
|---|
| 28 | |
|---|
| 29 | namespace OgreBulletDynamics |
|---|
| 30 | { |
|---|
| 31 | // ------------------------------------------------------------------------- |
|---|
| 32 | ConeTwistConstraint::ConeTwistConstraint(RigidBody * rbA, RigidBody * rbB, |
|---|
| 33 | const Vector3& FrameInAVector3, const Quaternion& FrameInAOrientation, |
|---|
| 34 | const Vector3& FrameInBVector3, const Quaternion& FrameInBOrientation): |
|---|
| 35 | TypedConstraint(rbA, rbB) |
|---|
| 36 | { |
|---|
| 37 | btTransform frameInA (OgreBulletCollisions::OgreBtConverter::to(FrameInAOrientation), |
|---|
| 38 | OgreBulletCollisions::OgreBtConverter::to(FrameInAVector3)); |
|---|
| 39 | btTransform frameInB (OgreBulletCollisions::OgreBtConverter::to(FrameInBOrientation), |
|---|
| 40 | OgreBulletCollisions::OgreBtConverter::to(FrameInBVector3)); |
|---|
| 41 | |
|---|
| 42 | mConstraint = new btConeTwistConstraint( |
|---|
| 43 | *rbA->getBulletRigidBody (), |
|---|
| 44 | *rbB->getBulletRigidBody (), |
|---|
| 45 | frameInA, |
|---|
| 46 | frameInB); |
|---|
| 47 | } |
|---|
| 48 | //------------------------------------------------------------------------- |
|---|
| 49 | ConeTwistConstraint::~ConeTwistConstraint() |
|---|
| 50 | { |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | void ConeTwistConstraint::setLimit(Ogre::Real a, Ogre::Real b, Ogre::Real c) |
|---|
| 54 | { |
|---|
| 55 | dynamic_cast<btConeTwistConstraint*>(mConstraint)->setLimit(a,b,c); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | } |
|---|
| 59 | |
|---|