Altren
29-05-2010 00:11:04
I added Object::setShape that use given SceneNode instead of creating new one (similar function used in RigidBody).
Also I just realized that OgreBullet licensed under GPL now - not LGPL. And I can't use it any more, because my application is not Open Source
Why OgreBullet is not LGPL? LGPL gives possibility to use it in DLL form in closed-source applications.
Index: include/OgreBulletCollisionsObject.h
===================================================================
--- include/OgreBulletCollisionsObject.h (revision 2907)
+++ include/OgreBulletCollisionsObject.h (working copy)
@@ -90,6 +90,10 @@
void setShape(CollisionShape *shape,
const Ogre::Vector3 &pos,
const Ogre::Quaternion &quat);
+ void setShape(Ogre::SceneNode *node,
+ CollisionShape *shape,
+ const Ogre::Vector3 &pos,
+ const Ogre::Quaternion &quat);
void showDebugShape(bool show);
Ogre::SceneNode *getRootNode() { return mRootNode; }
Index: src/OgreBulletCollisionsObject.cpp
===================================================================
--- src/OgreBulletCollisionsObject.cpp (revision 2907)
+++ src/OgreBulletCollisionsObject.cpp (working copy)
@@ -146,6 +146,29 @@
mObject->getWorldTransform().setRotation(btQuaternion(quat.x, quat.y, quat.z, quat.w));
}
+ //-----------------------------------------------------------------------
+ void Object::setShape(Ogre::SceneNode *node,
+ CollisionShape *shape,
+ const Vector3 &pos,
+ const Quaternion &quat)
+ {
+ mShape = shape;
+
+ mRootNode = node;
+
+ mShapeNode = mRootNode->createChildSceneNode(mName + "Shape");
+ mShapeNode->attachObject(this);
+
+ node->setPosition (pos);
+ node->setOrientation (quat);
+
+ mObject->setCollisionShape(shape->getBulletShape());
+ showDebugShape(mWorld->getShowDebugShapes());
+
+ mObject->getWorldTransform().setOrigin(btVector3(pos.x, pos.y, pos.z));
+ mObject->getWorldTransform().setRotation(btQuaternion(quat.x, quat.y, quat.z, quat.w));
+
+ }
// -------------------------------------------------------------------------
//-----------------------------------------------------------------------
void Object::_notifyAttached(Node* parent, bool isTagPoint)
@@ -198,4 +221,3 @@
{
}
}
-
Also I just realized that OgreBullet licensed under GPL now - not LGPL. And I can't use it any more, because my application is not Open Source
Why OgreBullet is not LGPL? LGPL gives possibility to use it in DLL form in closed-source applications.