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


C++ Mat4x4::GetPosition方法代码示例

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


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

示例1: VSyncVisibleScene

void PhysXPhysics::VSyncVisibleScene()
{
	for (ActorIdToPysXRigidBodyTable::const_iterator it = m_actorRigidBodyMap.begin(); it != m_actorRigidBodyMap.end(); it++)
	{
		ActorId const id = it->first;

		PxTransform pxLoc = it->second->getGlobalPose();
		Mat4x4 loc;
		PxMatrixToMat4x4(PxMat44(pxLoc), &loc);
		
		Actor* pActor = g_pApp->m_pGame->VGetActor(id);
		if (pActor)
		{
			TransformComponent* pTransformComponent = pActor->GetComponent<TransformComponent>(TransformComponent::g_Name);

			if (pTransformComponent)
			{
				if (pTransformComponent->GetTransform() != loc)
				{
					Vec3 rot = loc.GetYawPitchRoll();
					pTransformComponent->SetPosition(loc.GetPosition());
					pTransformComponent->SetRotation(Vec3(XMConvertToDegrees(rot.x), XMConvertToDegrees(rot.y), XMConvertToDegrees(rot.z)));
					EventDataPtr pEvent(BE_NEW EvtData_Move_Actor(id, loc));
					IEventManager::Get()->VQueueEvent(pEvent);
				}
			}
		}
	}
}
开发者ID:jel-massih,项目名称:BombastEngine,代码行数:29,代码来源:PhysXPhysics.cpp

示例2: VOnUpdate

//
// TeapotWarsGame::VOnUpdate			- Chapter 19, page 709
//
void CometConquestGame::VOnUpdate(float time, float elapsedTime)
{
	int deltaMilliseconds = int(elapsedTime * 1000.0f);
	m_Lifetime += elapsedTime;
	unsigned int currentTime = timeGetTime();
	BaseGameLogic::VOnUpdate(time, elapsedTime);

	if (m_bProxy)
		return;

	switch(m_State)
	{
	case BGS_LoadingGameEnvironment:
		break;

	case BGS_MainMenu:
		break;

	case BGS_WaitingForPlayers:
		if (m_ExpectedPlayers + m_ExpectedRemotePlayers == m_HumanPlayersAttached ) 
		{
			VChangeState(BGS_LoadingGameEnvironment);
		}
		break;

	case BGS_Running:
		if(currentTime > (m_data.m_lastCometTime + 5000))
		{
			Vec4 at = -g_Right4 * 2.0f;
			Vec4 atWorld = Mat4x4::g_Identity.Xform(at);
			int randVertical = m_random.Random(115) + 1 - 60;
			Vec3 normalDir(atWorld);
			normalDir.Normalize();
			Mat4x4 temp = Mat4x4::g_Identity;
			temp.SetPosition(Vec3(110,10,randVertical));
			CometParams cp;
			cp.m_Pos = temp.GetPosition() + Vec3(atWorld);
			cp.m_Radius = 6.0f;
			cp.m_Color = g_Cyan;
			cp.m_NormalDir = normalDir;
			cp.m_Force = 40000.0f;

			const EvtData_Request_New_Actor cannonBallEvt( &cp );
			safeTriggerEvent( cannonBallEvt );
			m_data.m_lastCometTime = currentTime;
		}
		break;
	default:
		assert(0 && _T("Unrecognized state."));
	}

	// look in Chapter 15, page 563 for more on this bit of code
	if(m_pPhysics)
	{
		m_pPhysics->VOnUpdate(elapsedTime);
		m_pPhysics->VSyncVisibleScene();
	}
}
开发者ID:jmazar,项目名称:CometConquest,代码行数:61,代码来源:CometConquest.cpp

示例3: RotateY

void PhysicsComponent::RotateY(float angleRadians)
{
    shared_ptr<TransformComponent> pTransformComponent = MakeStrongPtr(m_pOwner->GetComponent<TransformComponent>(TransformComponent::g_Name));
    if (pTransformComponent)
    {
        Mat4x4 transform = pTransformComponent->GetTransform();
        Vec3 position = transform.GetPosition();

        Mat4x4 rotateY;
        rotateY.BuildRotationY(angleRadians);
        rotateY.SetPosition(position);

        KinematicMove(rotateY);
    }
    else
        GCC_ERROR("Attempting to call RotateY() on actor with no transform component");
}
开发者ID:AsbjoernS,项目名称:gamecode4,代码行数:17,代码来源:PhysicsComponent.cpp


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