I'm guessing that there has to be a function within the Bullet library that would do it. Either that, or perhaps you can turn off the rigidbody, position the node, then turn it back on again or something along those lines.
Update:
did some looking and found the function setActiveState() which seems like the kind of function to do the job, but I get the same error as with setPosition(), anybody know the function I need?
Other Update:
So I was doing some more looking around and found this lovely thread on the bullet physics forums which features posts from cobra himself:
http://bulletphysics.org/Bullet/phpBB3/ ... php?t=5501
here is the code that cobra posted on that site:
Code: Select all
// Copyright (C) 2009-2010 Josiah Hartzell (Skyreign Software)
// This file is part of the "irrBullet" Bullet physics extension library and wrapper.
// For conditions of distribution and use, see copyright notice in irrbullet.h
#include "Bullet/btBulletDynamicsCommon.h"
#include "Bullet/btBulletCollisionCommon.h"
#include "motionstate.h"
#include "bulletworld.h"
using namespace irr;
using namespace core;
using namespace scene;
IMotionState::IMotionState(const btTransform &initialPos)
{
worldTransform = initialPos;
ManualRotation = false;
VelocityAsRotation = false;
}
void IMotionState::getWorldTransform(btTransform &worldTrans) const
{
worldTrans = worldTransform;
}
void IMotionState::setWorldTransform(const btTransform &worldTrans)
{
if(object)
{
ISceneNode *node = object->getCollisionShape()->getSceneNode();
irr::core::matrix4 matr;
btTransformToIrrlichtMatrix(worldTrans, matr);
node->setPosition(matr.getTranslation());
if(!ManualRotation)
{
node->setRotation(matr.getRotationDegrees());
}
worldTransform = worldTrans;
}
else if(failed == false)
printf("irrBullet: [ERR] Object (%i) could not be updated\n", object->getUniqueID());
}
IMotionState::~IMotionState()
{
}
Code: Select all
IMotionState* TransformThingy;
Although I'm not quite sure how I'm supposed to implement it as the code listed in the thread doesn't seem to show a constructor or function which takes a scene node or rigid body as an argument. Or does it work like one adds a rigidbody to a bulletworld simulation:
Code: Select all
TransformClass *ClassInstance = alreadyCreatedRigidBody->addClassInstance(ClassInstance);