Beispiel #1
0
/** Rotate around in local coordinates
 * @param angle the angle to rotate in radians
 * @param axis the vector rotate around
 */
void Position::rotateLocal(float angle, const Vector3f& axis)
{
	// transform the rotation axis to world coordinates
	Matrix44f rotMat;
	this->getRotationMatrix(rotMat);
	Vector3f worldAxis(axis);
	worldAxis.transform(rotMat);
	
	// perform rotation
	this->rotate(angle, worldAxis);
}
Beispiel #2
0
b2Joint* makePrismaticJoint(b2World* world, b2Body* a, b2Body *b)
{
   // make prismatic joint between 2 bodies
   b2PrismaticJointDef jointDef;
   b2Vec2 worldAxis(1.0,0.0);
   jointDef.Initialize(a,b,a->GetWorldCenter(), worldAxis);
   jointDef.lowerTranslation = -5.f;
   jointDef.upperTranslation = 5.f; // muscles can only contract
   jointDef.enableLimit = true;
   jointDef.maxMotorForce = 500.0f;
   jointDef.motorSpeed = 0.0f;
   jointDef.enableMotor = true;
   return world->CreateJoint(&jointDef);
}