Problem with Bullet

Problems building or running the engine, queries about how to use features etc.
risanchez
Halfling
Posts: 44
Joined: Wed Feb 15, 2012 11:31 pm

Problem with Bullet

Post by risanchez »

Hi,

I have problem with Bullet when I use the last Ogre 1.8. However, with Ogre 1.8 RC1 I do not have the problem.
So far, I can not say specifically exactly what is going on. For some reason the MotionState of Bullet is not working
properly with the new Ogre 1.8, and the graphics objects in Ogre get a not wanted behaviour.
Does any body have a problem with Bullet?
I am not using the sdk but my own compilation with Visual 2010. The same I did before with Ogre 1.8 RC1.

Risanchez
User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 578
Joined: Mon Jun 15, 2009 8:29 pm
x 64

Re: Problem with Bullet

Post by chaosavy »

I don't think you are giving enough info to try to help you - "So far, I can not say specifically exactly what is going on"
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer
risanchez
Halfling
Posts: 44
Joined: Wed Feb 15, 2012 11:31 pm

Re: Problem with Bullet

Post by risanchez »

Hi,

Here is more information. I have an scene like a billiard table with four balls.
I pick one, apply an impulse force and hit the others. The dynamic movements of all the balls
work perfectly with Ogre 1.8 RC1 y Bullet 2.8 version 2531.
However, when I compile exactly the same program with the same Bullet 2.8, but using the new Ogre 1.8
the ball hit the others and all of them fly in the sky. When I apply the impulse force everything happen
too fast and fly out of control. So, what I think is happening is that Bullet is working ok, but for
some reason Ogre is not getting the right position coordinates of the balls passed by the MotionState of Bullet.
For this I implemented my own class(explained in Bullet Wiki) from Bullet Motion State and use these instruction after dynamic step:

dynamicsWorld->stepSimulation(1/60.f,100);
btTransform trans;
fallRigidBody->getMotionState()->getWorldTransform(trans);//These pass the new position coordinates to Ogre.

My class from Motion State is:

MyMotionState::MyMotionState(const btTransform &initialpos, Ogre::SceneNode *node) {
mVisibleobj = node;
mPos1 = initialpos;
}

MyMotionState::~MyMotionState() {
}

void MyMotionState::setNode(Ogre::SceneNode *node) {
mVisibleobj = node;
}

void MyMotionState::getWorldTransform(btTransform &worldTrans) const {
worldTrans = mPos1;
}

void MyMotionState::setWorldTransform(const btTransform &worldTrans) {
if(NULL == mVisibleobj)
return; // silently return before we set a node
btQuaternion rot = worldTrans.getRotation();
mVisibleobj->setOrientation(rot.w(), rot.x(), rot.y(), rot.z());
btVector3 pos = worldTrans.getOrigin();
mVisibleobj->setPosition(pos.x(), pos.y(), pos.z());
}

Risanchez
Please let me know if you need more information.
User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 578
Joined: Mon Jun 15, 2009 8:29 pm
x 64

Re: Problem with Bullet

Post by chaosavy »

did you run this in debug mode and watched your variables and see what data Bullet passes to Ogre?

Also I don't see where Bullet tells Ogre the positions and orientations... unless I somehow missed it.
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer
risanchez
Halfling
Posts: 44
Joined: Wed Feb 15, 2012 11:31 pm

Re: Problem with Bullet

Post by risanchez »

Thanks,

I will do that with the debug.

mVisibleobj takes care of passing the new orientation and position to Ogre node
by invoking getWorldtransform(). The key is trans which is defined as a btTranform type.

it is posible to know what changes where made to Ogre RC1 to the final stable version?

risanchez
User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 578
Joined: Mon Jun 15, 2009 8:29 pm
x 64

Re: Problem with Bullet

Post by chaosavy »

tQuaternion rot = worldTrans.getRotation();
mVisibleobj->setOrientation(rot.w(), rot.x(), rot.y(), rot.z());
btVector3 pos = worldTrans.getOrigin();
mVisibleobj->setPosition(pos.x(), pos.y(), pos.z());

I think you shoudl forget about Ogre being at fault here... instead look into the above code, I don't know off the top of my head whether Bullet uses xyz as positions just like Ogre does same for the quaternion, but I believe that it doesn't.
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer
risanchez
Halfling
Posts: 44
Joined: Wed Feb 15, 2012 11:31 pm

Re: Problem with Bullet

Post by risanchez »

Thanks again,

but, then It should fail in both cases.
In both cases I use Bullet 2.8 version2531. It only happen when I compile with Ogre 1.8 new.
It does not happen with Ogre 1.8RC1 and then I do not think what you suggest is the reason of the failure.
Now I integrated the falcon haptic device with the Ogre 1.8 RC1 and works perfectly.

risanchez
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: Problem with Bullet

Post by jacmoe »

risanchez wrote:I have problem with Bullet when I use the last Ogre 1.8. However, with Ogre 1.8 RC1 I do not have the problem.
So far, I can not say specifically exactly what is going on.
You just need to figure out the difference between Ogre 1.8 RC1 and Ogre 1.8 'final'.
Bullet is really none of our concern, but I gather that you are using the exact same version (and configuration) with both.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
risanchez
Halfling
Posts: 44
Joined: Wed Feb 15, 2012 11:31 pm

Re: Problem with Bullet

Post by risanchez »

Thanks again.

risanchez
fd9_
Halfling
Posts: 64
Joined: Wed Aug 20, 2008 9:20 pm
x 22

Re: Problem with Bullet

Post by fd9_ »

I doubt this will solve your problem, but I noticed your maxSubSteps seems really high. You may also want to incorporate your timestep. Try something like:

Code: Select all

dynamicsWorld->stepSimulation( millisecondsSinceLastFrame, 5 );
risanchez
Halfling
Posts: 44
Joined: Wed Feb 15, 2012 11:31 pm

Re: Problem with Bullet

Post by risanchez »

thanks for your patience,

I will try that, but the behaviour between the Ogre RC1 and the New Ogre is what still puzzle me.
Question: Do you know if something was changed with respect to the parent and child objects in the new Ogre.
setPosition in the Node of Ogre make a change with respect to the parent's position and what happen when I execute
the application compiled with the new Ogre is similar as if the change in position speed up and get to anywhere.

Thanks again,

risanchez.

any way with Ogre 1.8 RC1 it works quite well.