querying btRigidBody from btRaycastInfo

jauthu
Posts: 12
Joined: Tue Feb 28, 2012 7:34 pm

querying btRigidBody from btRaycastInfo

Post by jauthu »

I created a btRigidBody

Code: Select all

        ...
	btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(
            this->mass,
            this->motionState,
            this->shape,
            fallInertia);
	fallRigidBodyCI.m_friction = 1.0f
	this->rigidBody = new btRigidBody(fallRigidBodyCI);

	this->rigidBody->setDamping(0.4, 0.4);
	this->physicsWorld->addRigidBody(rigidBody);
	this->rigidBody->setFriction(this->friction);
	std::cout << this->rigidBody << std::endl; 
and when I query him in my idle function, I get a weird result:

Code: Select all

            btWheelInfo	&wheel_inf = this->vehicle->getWheelInfo(i);

            btCollisionObject *contact_obj = (btCollisionObject*) (wheel_inf.m_raycastInfo.m_groundObject);

            if (contact_obj) {
                std::cout << "friction "
                          << contact_obj->getFriction()
                          << std::endl;
            }
I get output "friction 0.5", but expected "friction 1.0"

Runned in debugger, when adding btRigidBody(first code block), print this->rigidBody output differs from (second code block) print contac_obj. And when contacting with another btRigidBody, output of print contac_obj is the same all the time.

How can I proceed to actual rigidBody/collisionObject? It seems that any contact of Ray points to internal Bullet representation of RigidBody, where all of them is the one.
jauthu
Posts: 12
Joined: Tue Feb 28, 2012 7:34 pm

Re: querying btRigidBody from btRaycastInfo

Post by jauthu »

Searching the forum I found http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=3751 thread. Uncommenting this btRaycastVehicle.cpp#199 line helped for those users, but I would be very grateful for any claryfications on that side. Thanks.