Ejemplo n.º 1
0
void
dxJointHinge2::setRelativeValues()
{
    dVector3 anchor;
    dJointGetHinge2Anchor(this, anchor);
    setAnchors( this, anchor[0], anchor[1], anchor[2], anchor1, anchor2 );

    dVector3 axis;

    if ( node[0].body )
    {
        dJointGetHinge2Axis1(this, axis);
        setAxes( this, axis[0],axis[1],axis[2], axis1, NULL );
    }

    if ( node[0].body )
    {
        dJointGetHinge2Axis2(this, axis);
        setAxes( this, axis[0],axis[1],axis[2], NULL, axis2 );
    }

    dVector3 ax1, ax2;
    getAxisInfo( ax1, ax2, axis, s0, c0 );

    makeV1andV2();
    makeW1andW2();
}
Ejemplo n.º 2
0
Vec3f PhysicsHinge2Joint::getAxis1(void)
{
	PhysicsHinge2JointPtr tmpPtr(*this);
	dVector3 a;
	dJointGetHinge2Axis1(tmpPtr->id, a);
	return Vec3f(a[0], a[1], a[2]);
}
Ejemplo n.º 3
0
/**
 * This method is called if the joint should be detached. It stores
 * the actual Joint-axis, which can change their orientation at
 * Hinge2Joints, and destroys the helper body and joint.
 **/
void Hinge2Joint::detachJoint() {
	if (active && joint)
	{
		TransformationData entityTrans;
		dVector3 vec;
		dJointGetHinge2Axis1(joint, vec);
		axis1[0] = vec[0];
		axis1[1] = vec[1];
		axis1[2] = vec[2];
		dJointGetHinge2Axis2(joint, vec);
		axis2[0] = vec[0];
		axis2[1] = vec[1];
		axis2[2] = vec[2];
		if (mainEntity != NULL)
		{
			entityTrans = mainEntity->getEnvironmentTransformation();
			gmtl::Quatf entityRot;
			gmtl::Vec3f scaleVec;
			gmtl::AxisAnglef axAng;

	// get the inverse scale values of the mainEntity
/*			scaleVec[0] = 1.0f/mainEntity->getXScale();
			scaleVec[1] = 1.0f/mainEntity->getYScale();
			scaleVec[2] = 1.0f/mainEntity->getZScale();*/
			scaleVec[0] = 1.0f/entityTrans.scale[0];
			scaleVec[1] = 1.0f/entityTrans.scale[1];
			scaleVec[2] = 1.0f/entityTrans.scale[2];
	// get the inverse Rotation of the mainEntity
// 			axAng[0] = -mainEntity->getRotAngle();
// 			axAng[1] = mainEntity->getXRot();
// 			axAng[2] = mainEntity->getYRot();
// 			axAng[3] = mainEntity->getZRot();
// 			gmtl::set(entityRot, axAng);
			entityRot = entityTrans.orientation;
			gmtl::invert(entityRot);

			axis1 *= entityRot;
			axis2 *= entityRot;

			axis1[0] *= scaleVec[0];
			axis1[1] *= scaleVec[1];
			axis1[2] *= scaleVec[2];

			axis2[0] *= scaleVec[0];
			axis2[1] *= scaleVec[1];
			axis2[2] *= scaleVec[2];

			gmtl::normalize(axis1);
			gmtl::normalize(axis2);
		} // if
	} // if

	if (usedHelperJoint)
	{
		dJointDestroy(helperJoint);
		dBodyDestroy(helperBody);
		usedHelperJoint = false;
	} // if
} // detachJoint
Ejemplo n.º 4
0
static void get_phys_joint_axis_1(dJointID j, float *v)
{
    dVector3 V = { 0, 0, 0 };

    switch (dJointGetType(j))
    {
    case dJointTypeHinge:     dJointGetHingeAxis     (j, V); break;
    case dJointTypeSlider:    dJointGetSliderAxis    (j, V); break;
    case dJointTypeHinge2:    dJointGetHinge2Axis1   (j, V); break;
    case dJointTypeUniversal: dJointGetUniversalAxis1(j, V); break;
    default: break;
    }

    v[0] = (float) V[0];
    v[1] = (float) V[1];
    v[2] = (float) V[2];
}
Ejemplo n.º 5
0
void TSRODESteeringJoint::GetAxis1( TSRVector3& _vAxis1 )
{
	dJointGetHinge2Axis1( m_ODEJoint.m_JointID, _vAxis1.v );

}