1
안녕하세요 btCompoundShape, 에 문제가 있습니다. 2 실린더에서 모양을 만들지 만, 내 응용 프로그램을 실행할 때 compundshape 3 항목 것으로 보인다. 누구나 이유가 무엇입니까?btCompoundShape 여분의 모양을 추가했습니다
btRigidBody* Okno::addBolw(float x,float y,float z,float mass)
{
btTransform t; //position and rotation
t.setIdentity();
t.setOrigin(btVector3(x,y,z)); //put it to x,y,z coordinates
btCylinderShape * cylinder1 = new btCylinderShape(btVector3(1,1.7,1));
btCylinderShape * cylinder2 = new btCylinderShape(btVector3(0.5, 1, 0.5));
btCompoundShape * bolw = new btCompoundShape();
bolw->addChildShape(t,cylinder1);
t.setIdentity();
t.setOrigin(btVector3(x,y+2.7,z));
bolw->addChildShape(t, cylinder2);
btVector3 inertia(0,0,0);
btScalar masses[2] = { mass,mass/2};
bolw->calculatePrincipalAxisTransform(masses,t,inertia);
t.setIdentity();
btMotionState* motion=new btDefaultMotionState(t); //set the position (and motion)
btRigidBody::btRigidBodyConstructionInfo info(mass*2,motion,bolw,inertia); //create the constructioninfo, you can create multiple bodies with the same info
btRigidBody* body=new btRigidBody(info); //let's create the body itself
body->setFriction(1);
body->setRestitution(0);
world->addRigidBody(body); //and let the world know about it
bodies.push_back(body); //to be easier to clean, I store them a vector
return body;
}
나는 그래픽 모델을로드하지 않습니다 나는 모양을 추가 할 곳은 내 코드입니다
이 작은 것은 우는 모양이 모든 것을 파괴 ... : 나는 영상과 코드를 추가 정확한 물리 형태를보기 위해.