Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Constraint problem
PostPosted: Fri May 18, 2012 4:58 pm 
Offline

Joined: Tue May 01, 2012 11:52 am
Posts: 11
Hi all,
I just implemented bullet into my game. Everything is working well but now i have problems with constraints.
Code:
{
   dragging=ncakt;
   btVector3 pivA(0, 0, 0);
   btVector3 pivB(0, sT->polomer+2.3, 0);
   btVector3 axisa(0., 0., 1.);
   btVector3 axisb(0., 0., 1.);

   dragging->m_body->setAngularFactor(btVector3(0,0,0));
   dragging->m_body->clearForces();

   m_const = new btHingeConstraint(*m_body, *dragging->m_body,
      pivA, pivB, axisa,  axisb);
   m_const->setLimit(-0.2,0.2);
                  
   dynamicsWorld->addConstraint(m_const, true);
}
{
   dragginguwi=uwip;
   btVector3 pivA(0., 0., 0.);
   btVector3 pivB(0, sT->polomer+2.3, 0);
   btVector3 axisa(0., 0., 1.);
   btVector3 axisb(0., 0., 1.);

   dragginguwi->m_body->setAngularFactor(btVector3(0,0,0));
   dragginguwi->m_body->clearForces();

   m_const = new btHingeConstraint(*m_body, *dragginguwi->m_body,
      pivA, pivB, axisa,  axisb);
   m_const->setLimit(-0.2,0.2);
                  
   dynamicsWorld->addConstraint(m_const, true);
}

Destroyed dragged npc should be right beneath player but instead it is rotating around (click on the video) and item is also not under player but it appears to be somewhere at place (-2, 2, -0.5) by player (not in video). Constraint creation is basd on demo App_SliderConstraintDemo. I alredy tried
different constraint types but none of them worked correckt.

http://youtu.be/uaBgzVRmm0I

Could somebody please tell me what am i doing wrong?


Top
 Profile  
 
 Post subject: Re: Constraint problem
PostPosted: Mon May 21, 2012 3:51 pm 
Offline

Joined: Tue May 01, 2012 11:52 am
Posts: 11
bump
I also tried btSliderConstraint
Code:
{
   dragging=ncakt;
   btTransform frameInA, frameInB;
   frameInA = btTransform::getIdentity();
   frameInB = btTransform::getIdentity();
                  
   frameInA.setOrigin(btVector3(0,0,0));
   frameInB.setOrigin(btVector3(0,sT->polomer+2.5,0));

   dragging->m_body->setAngularFactor(btVector3(0,0,0));
   dragging->m_body->clearForces();

   m_const = new btSliderConstraint(*m_body, *dragging->m_body,
                     frameInA, frameInB, true);
   m_const->setLowerLinLimit(0);
   m_const->setUpperLinLimit(0);

   dynamicsWorld->addConstraint(m_const);            
}
{
   dragginguwi=uwip;

   btTransform frameInA, frameInB;
   frameInA = btTransform::getIdentity();
   frameInB = btTransform::getIdentity();
                  
   frameInA.setOrigin(btVector3(0,0,0));
   frameInB.setOrigin(btVector3(0,sT->polomer+2.5,0));

   dragginguwi->m_body->setAngularFactor(btVector3(0,0,0));
   dragginguwi->m_body->clearForces();

   m_const = new btSliderConstraint(*m_body, *dragginguwi->m_body,
                     frameInA, frameInB, true);
   m_const->setLowerLinLimit(0);
   m_const->setUpperLinLimit(0);
                  
   dynamicsWorld->addConstraint(m_const);
}

Result was nearly the same
http://youtu.be/UqA-1ixaIg0


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], fractile, Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group