• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ogre::Quaternion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: approach

void EnemyController::approach(void)
{
	EnemyPlane* enemy = static_cast<EnemyPlane*>(IDManager::getPointer(_enemyName, ACTOR));
	Ogre::Vector3 temp = FCKnowledge::getSingleton().getPlayerPosition() - enemy->getPosition();
	Ogre::Vector3 direction = temp * enemy->getAxis();
	//std::cout<<direction.x<<" "<<direction.y<<" "<<direction.z<<std::endl;
	if(direction.angleBetween(Ogre::Vector3::NEGATIVE_UNIT_Z) >= Ogre::Radian(Ogre::Degree(1)))
	{
		Ogre::Quaternion test = direction.getRotationTo(Ogre::Vector3::NEGATIVE_UNIT_Z);
		Ogre::Degree angle = enemy->getRotateLimit();
		
		double yawNum = test.getYaw().valueDegrees()/(angle*WORLD_UPDATE_INTERVAL).valueDegrees();
		yawNum = Ogre::Math::Clamp(yawNum, -1.0, 1.0);
		enemy->yaw(yawNum);

		double pitchNum = test.getPitch().valueDegrees()/(angle*WORLD_UPDATE_INTERVAL).valueDegrees();
		pitchNum = Ogre::Math::Clamp(pitchNum, -1.0, 1.0);
		enemy->pitch(pitchNum);
		
		double rollNum = test.getRoll().valueDegrees()/(angle*WORLD_UPDATE_INTERVAL).valueDegrees();
		rollNum = Ogre::Math::Clamp(rollNum, -1.0, 1.0);
		enemy->roll(rollNum);
		
	}
	else
	{
		enemy->yaw(0);
		enemy->pitch(0);
		enemy->roll(0);
	}
}
开发者ID:utah2013zyd,项目名称:Game,代码行数:31,代码来源:EnemyController.cpp


示例2: createMapObj

int Terrain::createMapObj(int x, int y, std::string meshname, int dir)
{
	stTileEntityData* entitydata = new stTileEntityData;
	entitydata->mTileEntity = Core::getSingleton().mSceneMgr->createEntity(meshname);
	entitydata->mTileNode = mTerrainNode->createChildSceneNode();
	entitydata->mTileNode->attachObject(entitydata->mTileEntity);
	float xx,yy;
	getWorldCoords(x,y,xx,yy);
	entitydata->mTileNode->setPosition(xx ,getHeight(xx,yy),yy);

	Ogre::Quaternion q;
	switch(dir)
	{
	case North:
		q.FromAngleAxis(Ogre::Degree(180),Ogre::Vector3(0,1,0));
		break;
	case South:
		q.FromAngleAxis(Ogre::Degree(360),Ogre::Vector3(0,1,0));
		break;
	case West:
		q.FromAngleAxis(Ogre::Degree(270),Ogre::Vector3(0,1,0));
		break;
	case East:
		q.FromAngleAxis(Ogre::Degree(90),Ogre::Vector3(0,1,0));
		break;
	}
	entitydata->mTileNode->setOrientation(q);
	mObjId ++;
	mMapObjMap.insert(std::map<int, stTileEntityData*>::value_type(mObjId,entitydata ));
	return mObjId;
}
开发者ID:weimingtom,项目名称:fdux-slg-game,代码行数:31,代码来源:Terrain.cpp


示例3: SetupAnimation

void OgreApplication::SetupAnimation(Ogre::String object_name){

	/* Retrieve scene manager and root scene node */
    Ogre::SceneManager* scene_manager = ogre_root_->getSceneManager("MySceneManager");
	Ogre::SceneNode* root_scene_node = scene_manager->getRootSceneNode();

	/* Set up animation */
	Ogre::Real duration = Ogre::Math::TWO_PI;
	Ogre::Real num_steps = 36;
	Ogre::Real step = duration/num_steps;
	Ogre::Animation* animation = scene_manager->createAnimation("Animation", duration);
	animation->setInterpolationMode(Ogre::Animation::IM_LINEAR);
	Ogre::Node *object_scene_node = root_scene_node->getChild(object_name);
	Ogre::NodeAnimationTrack* track = animation->createNodeTrack(0, object_scene_node);

	/* Set up frames for animation */
	Ogre::TransformKeyFrame* key;
	Ogre::Quaternion quat;
	for (int i = 0; i < num_steps; i++){
		Ogre::Real current = ((float) i) * step;
		key = track->createNodeKeyFrame(current);
		quat.FromAngleAxis(Ogre::Radian(-current), Ogre::Vector3(0, 1, 0));
		key->setRotation(quat);
		key->setScale(Ogre::Vector3(0.5, 0.5, 0.5));
	}

	/* Create animation state */
	animation_state_ = scene_manager->createAnimationState("Animation");
	animation_state_->setEnabled(true);
	animation_state_->setLoop(true);

	/* Turn on animating flag */
	animating_ = true;
}
开发者ID:FanZhang10,项目名称:NormalMap,代码行数:34,代码来源:ogre_application.cpp


示例4: setPositionOrientation

void PhysicsRagDoll::setPositionOrientation(const Ogre::Vector3& pos, const Ogre::Quaternion &orient)
{
    Ogre::Vector3 oldPos = mNode->_getDerivedPosition();
    Ogre::Quaternion oldOri = mNode->_getDerivedOrientation();
    Ogre::Quaternion oldOriInv = oldOri.Inverse();

    for (RagBoneMapIterator it = mRagBonesMap.begin(); it != mRagBonesMap.end(); it++)
    {
        OgreNewt::Body* body = it->second->getBody();
        if (body)
        {
            Ogre::Vector3 boneOldPos;
            Ogre::Quaternion boneOldOri;
            body->getPositionOrientation(boneOldPos, boneOldOri);
            
            // get old position and orientation in local space
            Ogre::Vector3 boneOldLocalPos = oldOriInv*(boneOldPos - oldPos);
            Ogre::Quaternion boneOldLocalOri = oldOriInv*boneOldOri;

            // calculate and set new position in orientation
            body->setPositionOrientation(pos + orient*boneOldLocalPos, orient*boneOldLocalOri);
            body->unFreeze();
        }
    }
    mNode->setPosition(pos);
    mNode->setOrientation(orient);
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:27,代码来源:PhysicsRagDoll.cpp


示例5: setPropertiesFromCamera

void FPSViewController::setPropertiesFromCamera( Ogre::Camera* source_camera )
{
  Ogre::Quaternion quat = source_camera->getOrientation() * ROBOT_TO_CAMERA_ROTATION.Inverse();
  float yaw = quat.getRoll( false ).valueRadians(); // OGRE camera frame looks along -Z, so they call rotation around Z "roll".
  float pitch = quat.getYaw( false ).valueRadians(); // OGRE camera frame has +Y as "up", so they call rotation around Y "yaw".

  Ogre::Vector3 direction = quat * Ogre::Vector3::NEGATIVE_UNIT_Z;

  if ( direction.dotProduct( Ogre::Vector3::NEGATIVE_UNIT_Z ) < 0 )
  {
    if ( pitch > Ogre::Math::HALF_PI )
    {
      pitch -= Ogre::Math::PI;
    }
    else if ( pitch < -Ogre::Math::HALF_PI )
    {
      pitch += Ogre::Math::PI;
    }

    yaw = -yaw;

    if ( direction.dotProduct( Ogre::Vector3::UNIT_X ) < 0 )
    {
      yaw -= Ogre::Math::PI;
    }
    else
    {
      yaw += Ogre::Math::PI;
    }
  }

  pitch_property_->setFloat( pitch );
  yaw_property_->setFloat( mapAngleTo0_2Pi( yaw ));
  position_property_->setVector( source_camera->getPosition() );
}
开发者ID:jkammerl,项目名称:rviz,代码行数:35,代码来源:fps_view_controller.cpp


示例6: initAxis

//-------------------------------------------------------------------------------------
void AxisLines::initAxis(Ogre::String boneName, Ogre::Entity* entity, Ogre::SceneManager* mSceneManager)
{

	if(isXVisible)	/* red */
	{
		xLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
		entity->attachObjectToBone(boneName, xLine);
		xLine->setMaterial(color1);
	}

	if(isYVisible) /* green */
	{
		yLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
		entity->attachObjectToBone(boneName, yLine);
		yLine->setMaterial(color2);
	}

	if(isZVisible) /* blue */
	{
		zLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
		entity->attachObjectToBone(boneName, zLine);
		zLine->setMaterial(color3);
	}

	Ogre::Bone* bone = entity->getSkeleton()->getBone(boneName);
	Ogre::Quaternion q = bone->getOrientation();
	this->updateLines(q.xAxis(), q.yAxis(), q.zAxis());
}
开发者ID:282114790,项目名称:ogrekinect,代码行数:29,代码来源:AxisLines.cpp


示例7: setDirection

//-----------------------------------------------------------------------------------------
void CCameraEditor::setDirection(const Ogre::Vector3 &vec)
{
    if (vec == Ogre::Vector3::ZERO) return;

    Ogre::Vector3 zAdjustVec = -vec;
    zAdjustVec.normalise();

    Ogre::Quaternion orientation;

    Ogre::Vector3 YawFixedAxis = Ogre::Vector3::UNIT_Y;
    Ogre::Vector3 xVec = YawFixedAxis.crossProduct( zAdjustVec );
    xVec.normalise();

    Ogre::Vector3 yVec = zAdjustVec.crossProduct( xVec );
    yVec.normalise();

    orientation.FromAxes( xVec, yVec, zAdjustVec );

    // transform to parent space
    if (mParentEditor->get())
    {
        orientation = mParentEditor->get()->getNode()->_getDerivedOrientation().Inverse() * orientation;
    }

    mOrientation->set(orientation);
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:27,代码来源:CameraEditor.cpp


示例8: snapTpPortal

//-------------------------------------------------------------------------------
bool PortalEditor::snapTpPortal(PortalEditor* dest,bool bAllowMove )
{
    //reposition & realign this portal (and its parent zone)
    //to connect with this portal.

    //Before snapping portals togther, we should check that the zone is
    //not already locked into position by another portal join.
    //However, even if this is the case, we can still join portals if
    //they are already in the correct position.

    //get current position data:
    Ogre::Quaternion qZone = mParentZone->getDerivedOrientation();
    Ogre::Quaternion qDest = dest->getDerivedOrientation();
    Ogre::Quaternion qPortal = this->getOrientation();
    Ogre::Vector3 vDest = dest->getDerivedPosition();
    Ogre::Vector3 vPortal = this->getDerivedPosition();


    const Ogre::Real DIST_EPSILON(0.01f);//fudge factor
    const Ogre::Radian ANG_EPSILON(0.01f);
    if(vPortal.distance(vDest)<DIST_EPSILON && qPortal.equals(qDest*Ogre::Quaternion(0,0,1,0),ANG_EPSILON))return true;
    if(!bAllowMove)return false;

    //orientation
    Ogre::Quaternion qNew = (qDest*Ogre::Quaternion(0,0,1,0))*qPortal.Inverse();
    mParentZone->setDerivedOrientation(qNew);

    //position
    Ogre::Vector3 vZone = mParentZone->getDerivedPosition();
    vPortal = this->getDerivedPosition();

    mParentZone->setDerivedPosition( (vDest - (vPortal-vZone)));

    return true;
}
开发者ID:xubingyue,项目名称:Ogitor,代码行数:36,代码来源:PortalEditor.cpp


示例9: frameRenderingQueued

	bool Framework::frameRenderingQueued(const Ogre::FrameEvent& evt)
	{
		mTrayMgr->frameRenderingQueued(evt);

		if (!mTrayMgr->isDialogVisible())
		{
			mCameraMan->frameRenderingQueued(evt);   // if dialog isn't up, then update the camera

			if (mDetailsPanel->isVisible())   // if details panel is visible, then update its contents
			{
				mDetailsPanel->setParamValue(0, Ogre::StringConverter::toString(mCamera->getDerivedPosition().x));
				mDetailsPanel->setParamValue(1, Ogre::StringConverter::toString(mCamera->getDerivedPosition().y));
				mDetailsPanel->setParamValue(2, Ogre::StringConverter::toString(mCamera->getDerivedPosition().z));
				mDetailsPanel->setParamValue(4, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().w));
				mDetailsPanel->setParamValue(5, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().x));
				mDetailsPanel->setParamValue(6, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().y));
				mDetailsPanel->setParamValue(7, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().z));

#ifdef USE_RTSHADER_SYSTEM
				mDetailsPanel->setParamValue(14, Ogre::StringConverter::toString(mShaderGenerator->getVertexShaderCount()));
				mDetailsPanel->setParamValue(15, Ogre::StringConverter::toString(mShaderGenerator->getFragmentShaderCount()));		
#endif

				Ogre::Quaternion q = mCamera->getDerivedOrientation();
				mDetailsPanel->setParamValue(16,  Ogre::StringConverter::toString(q.xAxis() ) );
				mDetailsPanel->setParamValue(17,  Ogre::StringConverter::toString(q.yAxis() ));
				mDetailsPanel->setParamValue(18,  Ogre::StringConverter::toString(q.zAxis() ));															

			}	

		}

		return true;
	}
开发者ID:chenbk85,项目名称:3dlearn,代码行数:34,代码来源:Framework.cpp


示例10: parseQuaternion

Ogre::Quaternion Util::parseQuaternion(TiXmlElement *XMLNode)
{
	Ogre::Quaternion orientation;

	if(XMLNode->Attribute("qx"))
	{
		orientation.x = Ogre::StringConverter::parseReal(XMLNode->Attribute("qx"));
		orientation.y = Ogre::StringConverter::parseReal(XMLNode->Attribute("qy"));
		orientation.z = Ogre::StringConverter::parseReal(XMLNode->Attribute("qz"));
		orientation.w = Ogre::StringConverter::parseReal(XMLNode->Attribute("qw"));
	}
	else if(XMLNode->Attribute("axisX"))
	{
		Ogre::Vector3 axis;
		axis.x = Ogre::StringConverter::parseReal(XMLNode->Attribute("axisX"));
		axis.y = Ogre::StringConverter::parseReal(XMLNode->Attribute("axisY"));
		axis.z = Ogre::StringConverter::parseReal(XMLNode->Attribute("axisZ"));
		Ogre::Real angle = Ogre::StringConverter::parseReal(XMLNode->Attribute("angle"));;
		orientation.FromAngleAxis(Ogre::Angle(angle), axis);
	}
	else if(XMLNode->Attribute("angleX"))
	{
		Ogre::Vector3 axis;
		axis.x = Ogre::StringConverter::parseReal(XMLNode->Attribute("angleX"));
		axis.y = Ogre::StringConverter::parseReal(XMLNode->Attribute("angleY"));
		axis.z = Ogre::StringConverter::parseReal(XMLNode->Attribute("angleZ"));
		//orientation.FromAxes(&axis);
		//orientation.F
	}

	return orientation;
}
开发者ID:agudpp,项目名称:CordobaZombie,代码行数:32,代码来源:Util.cpp


示例11: ProcessKeyInput

void AACamera::ProcessKeyInput(OIS::Keyboard *mKeyboard)
{
    static unsigned RollSpeed = 5;
    if (mKeyboard->isKeyDown(OIS::KC_RIGHT))
    {		
        if (abs(RelativeOrientation.getRoll().valueDegrees())<10)
        {
            Ogre::Quaternion q;
            q.FromAngleAxis(-Ogre::Degree(RollSpeed),Ogre::Vector3::UNIT_Z);
            CameraAdditionalRotation.StartRotation(RelativeOrientation, RelativeOrientation*q, CommonDeclarations::GetFPS());			
        }		
    }
    else
        if(mKeyboard->isKeyDown(OIS::KC_LEFT))
        {
            if (abs(RelativeOrientation.getRoll().valueDegrees())<10)
            {
                Ogre::Quaternion q;
                q.FromAngleAxis(Ogre::Degree(RollSpeed),Ogre::Vector3::UNIT_Z);
                CameraAdditionalRotation.StartRotation(RelativeOrientation, RelativeOrientation*q, CommonDeclarations::GetFPS());				
            }			
        }
        else
        {
            if (RelativeOrientation!=Ogre::Quaternion::IDENTITY)			
            {
                Ogre::Quaternion q = Ogre::Quaternion::IDENTITY;
                CameraAdditionalRotation.StartRotation(RelativeOrientation, q, CommonDeclarations::GetFPS());				
            }
        }
}
开发者ID:beorc,项目名称:flare_star,代码行数:31,代码来源:AACamera.cpp


示例12: updateWheel

void OgreWheel::updateWheel(const float angle)
{
	// Render change angle
	Ogre::Quaternion qq;
	qq.FromAngleAxis(Ogre::Radian(-angle)*5, Ogre::Vector3(0, 1, 0));
	mNode->setOrientation(qq);
}
开发者ID:landys,项目名称:cute-car,代码行数:7,代码来源:OgreAllVehicle.cpp


示例13: generateEnvironment

void GameState::generateEnvironment()
{
	
	Ogre::StaticGeometry *sg = mSceneMgr->createStaticGeometry("Asteroids");
	const int size = 7000;
    const int amount = 5;
	sg->setRegionDimensions(Ogre::Vector3(size, size, size));
	//sg->setOrigin(Ogre::Vector3(-size/2, 0, -size/2));
	sg->setOrigin(Vector3(-size/2, -size/2, -size/2) + Vector3(0, 0, 0)); // this will center the staticgeometry around the point in 3D space
	for (int x = -size/2; x < size/2; x += (size/amount))
	{
		for (int y = -size/2; y < size/2; y += (size/amount))
		{
			for (int z = -size/2; z < size/2; z += (size/amount))
			{
					Ogre::Real r = size / (float)amount / 2;
					Ogre::Vector3 pos(x + Ogre::Math::RangeRandom(-r, r), y + Ogre::Math::RangeRandom(-r, r), z + Ogre::Math::RangeRandom(-r, r));
					Ogre::Vector3 scale(Ogre::Math::RangeRandom(0.7, 20), Ogre::Math::RangeRandom(0.7, 20), Ogre::Math::RangeRandom(0.7, 20));
					Ogre::Quaternion orientation;
					orientation.FromAngleAxis(Ogre::Degree(Ogre::Math::RangeRandom(0, 359)), Ogre::Vector3::UNIT_Y);
					MyEntity * ent = new MyEntity("asteroid1.mesh", mSceneMgr, mWorld, pos);
					ent->transform(orientation, Ogre::Vector3::ZERO);
					//ent->setScale(scale);
					sg->addEntity(ent->getEntity(), pos, orientation/*, scale*/);
			}
		}
	}
	sg->build();

	

}
开发者ID:firbaOne,项目名称:My-first-game,代码行数:32,代码来源:GameState.cpp


示例14: setRotation

void SceneEntity::setRotation(float angel)
{
	mRotateAngel = angel;
	Ogre::Quaternion ori;
	ori.FromAngleAxis(Ogre::Radian(Ogre::Math::PI/180*mRotateAngel),Ogre::Vector3(0,1,0));
	mSceneNode->setOrientation(ori);
}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:7,代码来源:SceneEntity.cpp


示例15: setLocalRotation

void OgrePointSpecification::setLocalRotation(const VEHA::RotationVector& orientation)
{
	Ogre::Quaternion q;
	Ogre::Vector3 v(orientation.x,orientation.y,orientation.z);
	q.FromAngleAxis(Ogre::Radian(orientation.angle),v);
	_node->setOrientation(q);
	_node->_update(true,true);
}
开发者ID:DelamarreAlban,项目名称:Mascaret,代码行数:8,代码来源:OgrePointSpecification.cpp


示例16:

btMatrix3x3 Utility::convert_OgreMatrix3(const Ogre::Matrix3 &m)
{
	btMatrix3x3 mat;
	Ogre::Quaternion quat;
	quat.FromRotationMatrix(m);
	mat.setRotation(Utility::convert_OgreQuaternion(quat));
	return mat;
}
开发者ID:Dar13,项目名称:WastelandArchive,代码行数:8,代码来源:Utility.cpp


示例17: jet

void Vehicle::jet(NxReal stiff)
{
	Ogre::Quaternion quat = UtilityFunc::NxQuat_ToOgre_Quat(mActor->getGlobalOrientationQuat());
	NxVec3 nxv3			  = UtilityFunc::OgreVec3_To_NxVec3(quat.zAxis());

	nxv3.normalize();
	mActor->addForce(nxv3 * stiff, NX_IMPULSE);
}
开发者ID:flair2005,项目名称:Racing-Game,代码行数:8,代码来源:Vehicle.cpp


示例18: yaw

//-----------------------------------------------------------------------------------------
void CCameraEditor::yaw(const Ogre::Radian &value)
{
    Ogre::Quaternion q;

    q.FromAngleAxis(value, Ogre::Vector3::UNIT_Y);
    q.normalise();
    
    mOrientation->set(q * mOrientation->get());
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:10,代码来源:CameraEditor.cpp


示例19: roll

//-----------------------------------------------------------------------------------------
void CCameraEditor::roll(const Ogre::Radian &value)
{
    Ogre::Quaternion q;
    Ogre::Vector3 axis = mOrientation->get() * Ogre::Vector3::UNIT_Z;
    q.FromAngleAxis(value, axis);
    q.normalise();
    
    mOrientation->set(q * mOrientation->get());
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:10,代码来源:CameraEditor.cpp


示例20: moveInGameCamera

void AppFrameListener::moveInGameCamera()
{
	//mCamNode->setPosition(Ogre::Vector3(100,200,100));
	////mCamNode->setOrientation(planeOri);
	//mCamNode->lookAt(Ogre::Vector3::ZERO, Ogre::Node::TS_WORLD, Ogre::Vector3::UNIT_Z);

	//return;


	Ogre::Vector3 planePos, planeDir, planeOmega;
	Ogre::Quaternion planeOri;

	mAirplane->getPositionOrientation(planePos,	planeOri);	
	mAirplane->getOmega(planeOmega);

	planeOmega = planeOri.Inverse() * planeOmega;	

	mCamNode->setPosition(planePos);
	mCamNode->setOrientation(planeOri);
	
	
	if( Ogre::Math::Abs(planeOmega.x) - Ogre::Math::Abs(mLastPlaneOmegaX) < 60*mTimeSinceLastFrame)
		mLastPlaneOmegaX = planeOmega.x;
	if( Ogre::Math::Abs(planeOmega.z) - Ogre::Math::Abs(mLastPlaneOmegaZ) < 60*mTimeSinceLastFrame)
		mLastPlaneOmegaZ = planeOmega.z;
	//if( planeVel.z > 0 && planeVel.z - mLastPlaneSpeed < 1)
	//	mLastPlaneSpeed = planeVel.z;

	
	
	if(mCamPosition != 0 || mCamLookBack)
	{
		mCamNode->pitch( Ogre::Radian(mLastPlaneOmegaX)*-0.1 );
		mCamNode->roll( Ogre::Radian(mLastPlaneOmegaZ)*-0.1);
	}
	if(mCamLookBack)
	{
		mCamNode->yaw(Ogre::Degree(180));
		//mCamNode->translate(Ogre::Vector3(0,5,-20), Ogre::Node::TS_LOCAL);
	}
	
	mCamNode->translate(mCamTranslation, Ogre::Node::TS_LOCAL);			


	//Launch a ray from airplane in it's direction, to get the first hit in order 
	//to find the correct position for the crosshair
	Ogre::Vector3 closestPos;
	Ogre::Matrix4 camMatrix;			
	bool enemyHit = false;
	enemyHit = mAirplane->getTargetHitPoint(closestPos);
	camMatrix = mCamera->getProjectionMatrix() * mCamera->getViewMatrix(true);			
	mHUDManager->setCrosshairVScroll((camMatrix*closestPos).y, enemyHit);	

	

}
开发者ID:abmantis,项目名称:realtoys-aircombat,代码行数:56,代码来源:AppFrameListener.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ogre::Ray类代码示例发布时间:2022-05-31
下一篇:
C++ ogre::ParamDictionary类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap