raycast vehicle rightIndex = 1 does not work

jrk
Posts: 17
Joined: Tue Aug 18, 2009 2:48 pm

raycast vehicle rightIndex = 1 does not work

Post by jrk »

Hi,

I think I found a problem with btRaycastVehicle

It does not seem to work for the following settings:

Code: Select all

        rightIndex = 1;
        upIndex = 2;
        forwardIndex = 0;
        m_wheelAxleCS = btVector3(0,1,0);
        m_wheelDirectionCS0 = btVector3(0,0,1);
I think those familiar with the vehicle demos will know what that means.

I'm curious if anyone out there has tried to put the rightIndex to 1.
In the examples it is always 0
jrk
Posts: 17
Joined: Tue Aug 18, 2009 2:48 pm

Re: raycast vehicle rightIndex = 1 does not work

Post by jrk »

I think I found the problem. I think the following modification should be made to btRaycastVehicle.cpp ( this change is around line 120 )

Code: Select all

	btQuaternion steeringOrn(up,steering);//wheel.m_steering);
	btMatrix3x3 steeringMat(steeringOrn);

	btQuaternion rotatingOrn(right,-wheel.m_rotation);
	btMatrix3x3 rotatingMat(rotatingOrn);

	btMatrix3x3 basis2(
		right[0],fwd[0],up[0],
		right[1],fwd[1],up[1],
		right[2],fwd[2],up[2]
	);

//	wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2);
	wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * btMatrix3x3(m_chassisBody->getOrientation()));
The only lines I changed are the last 2. Commented out the current calculation of the world's transform and added my own.
Anyone agree? Disagree?