当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix3::FromEulerAnglesXYZ方法代码示例

本文整理汇总了C++中ogre::Matrix3::FromEulerAnglesXYZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::FromEulerAnglesXYZ方法的具体用法?C++ Matrix3::FromEulerAnglesXYZ怎么用?C++ Matrix3::FromEulerAnglesXYZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::Matrix3的用法示例。


在下文中一共展示了Matrix3::FromEulerAnglesXYZ方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setLocalOrientation

void OgrePointSpecification::setLocalOrientation(const Vector3& ori)
{
	Ogre::Matrix3 m;
	m.FromEulerAnglesXYZ(Ogre::Radian(ori.x),Ogre::Radian(ori.y),Ogre::Radian(ori.z));
	Ogre::Quaternion q(m);
	_node->setOrientation(q);
	_node->_update(true,true);
}
开发者ID:DelamarreAlban,项目名称:Mascaret,代码行数:8,代码来源:OgrePointSpecification.cpp

示例2: rotate

void OgrePointSpecification::rotate(const Vector3& orientation)
{
	Ogre::Matrix3 m;
	m.FromEulerAnglesXYZ(Ogre::Radian(orientation.x),Ogre::Radian(orientation.y),Ogre::Radian(orientation.z));
	Ogre::Quaternion q(m);
	_node->rotate(q,Ogre::Node::TS_LOCAL);
	_node->_update(true,true);
}
开发者ID:DelamarreAlban,项目名称:Mascaret,代码行数:8,代码来源:OgrePointSpecification.cpp

示例3: QuaternionFromRotationDegrees

Ogre::Quaternion LuaScriptUtilities::QuaternionFromRotationDegrees(
    Ogre::Real xRotation, Ogre::Real yRotation, Ogre::Real zRotation)
{
    Ogre::Matrix3 matrix;
    matrix.FromEulerAnglesXYZ(
        Ogre::Degree(xRotation), Ogre::Degree(yRotation), Ogre::Degree(zRotation));
    return Ogre::Quaternion(matrix);
}
开发者ID:Bewolf2,项目名称:LearningGameAI,代码行数:8,代码来源:LuaScriptUtilities.cpp

示例4: setGlobalOrientation

void OgrePointSpecification::setGlobalOrientation(const Vector3& ori)
{
	Ogre::Matrix3 m;
	m.FromEulerAnglesXYZ(Ogre::Radian(ori.x),Ogre::Radian(ori.y),Ogre::Radian(ori.z));
	Ogre::Quaternion q(m);
	if(_parent)
		q=shared_dynamic_cast<OgrePointSpecification>(_parent)->_node->convertWorldToLocalOrientation(q);
	_node->setOrientation(q);
	_node->_update(true,true);
}
开发者ID:DelamarreAlban,项目名称:Mascaret,代码行数:10,代码来源:OgrePointSpecification.cpp

示例5: surfaceOrientationForNormal

Ogre::Quaternion RoomSurface::surfaceOrientationForNormal(Ogre::Vector3 normal) {
  Ogre::Real pi_by_two = Ogre::Math::PI/2.0;
  Ogre::Matrix3 mat;

  if (normal == Ogre::Vector3::UNIT_Y) {
    mat.FromEulerAnglesXYZ(Ogre::Radian(0), Ogre::Radian(0), Ogre::Radian(0));
  } else if (normal == Ogre::Vector3::UNIT_X) {
    mat.FromEulerAnglesXYZ(Ogre::Radian(pi_by_two), Ogre::Radian(0), Ogre::Radian(-pi_by_two));
  } else if (normal == -Ogre::Vector3::UNIT_X) {
    mat.FromEulerAnglesXYZ(Ogre::Radian(pi_by_two), Ogre::Radian(0), Ogre::Radian(pi_by_two));
  } else if (normal == Ogre::Vector3::UNIT_Z) {
    mat.FromEulerAnglesXYZ(Ogre::Radian(pi_by_two), Ogre::Radian(0), Ogre::Radian(0));
  } else if (normal == -Ogre::Vector3::UNIT_Z) {
    // the last component should ideally be  Ogre::Radian(2*pi_by_two), however the corresponding
    // physics constraint has a problem with that.
    mat.FromEulerAnglesXYZ(Ogre::Radian(pi_by_two), Ogre::Radian(2*pi_by_two), Ogre::Radian(0));
  }
  return Ogre::Quaternion(mat);
}
开发者ID:DX94,项目名称:BumpTop,代码行数:19,代码来源:RoomSurface.cpp

示例6:

PhysicsRagDoll::RagBone::RagBone(PhysicsRagDoll* creator, OgreNewt::World* world, PhysicsRagDoll::RagBone* parent, Ogre::Bone* ogreBone, Ogre::MeshPtr mesh,
						  Ogre::Vector3 dir, PhysicsRagDoll::RagBone::BoneShape shape, Ogre::Vector3 size, Ogre::Real mass, Actor* parentActor)
{
	mDoll = creator;
	mParent = parent;
	mOgreBone = ogreBone;

	OgreNewt::ConvexCollisionPtr col;

	// in the case of the cylindrical primitives, they need to be rotated to align the main axis with the direction vector.
	Ogre::Quaternion orient = Ogre::Quaternion::IDENTITY;
	Ogre::Vector3 pos = Ogre::Vector3::ZERO;
	Ogre::Matrix3 rot;

	if (dir == Ogre::Vector3::UNIT_Y)
	{
		rot.FromEulerAnglesXYZ(Ogre::Degree(0), Ogre::Degree(0), Ogre::Degree(90));
		orient.FromRotationMatrix(rot);
	}

	if (dir == Ogre::Vector3::UNIT_Z)
	{
		rot.FromEulerAnglesXYZ(Ogre::Degree(0), Ogre::Degree(90), Ogre::Degree(0));
		orient.FromRotationMatrix(rot);
	}


	// make the rigid body.
	switch (shape)
	{
	case PhysicsRagDoll::RagBone::BS_BOX:
		col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box(world, size, 0));
		break;

	case PhysicsRagDoll::RagBone::BS_CAPSULE:
		col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Capsule(world, size.y, size.x, 0, orient, pos));
		break;

	case PhysicsRagDoll::RagBone::BS_CONE:
		col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cone(world, size.y, size.x, 0, orient, pos));
		break;

	case PhysicsRagDoll::RagBone::BS_CYLINDER:
		col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(world, size.y, size.x, 0, orient, pos));
		break;

	case PhysicsRagDoll::RagBone::BS_ELLIPSOID:
		col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Ellipsoid(world, size, 0));
		break;

	case PhysicsRagDoll::RagBone::BS_CONVEXHULL:
		col = _makeConvexHull(world, mesh, size.x);
		break;

	default:
		col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box(world, size, 0));
		break;
	}

    if (col)
    {
        if (col->getNewtonCollision() == NULL)
        {
            col.reset();
        }
    }

    if (!col)
    {
        LOG_WARNING(Logger::CORE, " error creating collision for '" + ogreBone->getName() + "', still continuing.");
        mBody = NULL;
    }
    else
    {
    	mBody = new OgreNewt::Body(world, col);
        mBody->setUserData(Ogre::Any(parentActor));
    	mBody->setStandardForceCallback();
        const OgreNewt::MaterialID* ragdollMat = PhysicsManager::getSingleton().createMaterialID("default");
        mBody->setMaterialGroupID(ragdollMat);

	    Ogre::Vector3 inertia;
    	Ogre::Vector3 com;
    	col->calculateInertialMatrix(inertia, com);
	
	    mBody->setMassMatrix(mass, inertia * mass);
    	mBody->setCenterOfMass(com);

	    mBody->setCustomTransformCallback(PhysicsRagDoll::_placementCallback);


    	mOgreBone->setManuallyControlled(true);
    }
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:93,代码来源:PhysicsRagDoll.cpp


注:本文中的ogre::Matrix3::FromEulerAnglesXYZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。