static object appear at 0,0,0 always

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
JohnBoyMan
Posts: 14
Joined: Tue Jun 28, 2011 4:11 am

static object appear at 0,0,0 always

Post by JohnBoyMan »

hello i am trying to make a static object like thus.

Code: Select all

	btVector3 localInertia8(0,0,0);
	btTransform localTrans;
	localTrans.setIdentity();
	
    btTransform groundTransform1;
    groundTransform1.setIdentity();
    
    btScalar mass1( 0 );
	//bool isDynamic8 = ( mass1 != 0.f );
  
	btVector3 localInertia( 0,0,0 );
	//if ( isDynamic8 )
    //colShape->calculateLocalInertia( mass1,localInertia );
	groundTransform1.setOrigin(btVector3(BtOgre::Convert::toBullet( mW[k] + Ogre::Vector3(0,6,0 ))));
    MyMotionState* motionState1 = new MyMotionState( groundTransform1,wall1[k] ); 
    btRigidBody::btRigidBodyConstructionInfo rbInfoo( mass1,motionState1,colShape1[k],localInertia );
    body6[k] = new btRigidBody( rbInfoo );
	body6[k]->setFriction( 1.0f ); 

The problem is that the body always appears at 0,0,0 in my game. I cant get around it. and rays dont hit it either wats going on thanks
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm
Contact:

Re: static object appear at 0,0,0 always

Post by Dr.Shepherd »

I suppose you write your own motionstate class:

Code: Select all

    MyMotionState* motionState1 = new MyMotionState( groundTransform1,wall1[k] ); 
Did you check if it works ?

Why not just use btDefaultMotionState:

Code: Select all

btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
Post Reply