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


C++ NxVec3::get方法代码示例

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


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

示例1: Update

	void Update ( void )
	{
		NxVec3 forceDir ( -1, 0, 0 );
		NxReal forceStrength = 100;
		NxVec3 forceVec = forceStrength*forceDir;
		this->tractor->addForce(forceVec);

		g_iValue = 10;

		for (int i=0; i<2; i++)
		{
			NxMat34 pose   = frontWheels [ i ].wheel->getGlobalPose ( );
			NxMat33 orient = pose.M;
			NxVec3  pos    = pose.t;

			float glmat[16];
			orient.getColumnMajorStride4(&(glmat[0]));
			pos.get(&(glmat[12]));
			glmat[3] = glmat[7] = glmat[11] = 0.0f;
			glmat[15] = 1.0f;

			SetWorldMatrix ( g_iValue, ( D3DXMATRIX* ) &glmat );
			sObject* pObject = dbGetObject ( g_iValue++ );
			pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
		}

		for (int i=0; i<2; i++)
		{
			NxMat34 pose   = steerWheels [ i ].wheel.wheel->getGlobalPose ( );
			NxMat33 orient = pose.M;
			NxVec3  pos    = pose.t;

			float glmat[16];
			orient.getColumnMajorStride4(&(glmat[0]));
			pos.get(&(glmat[12]));
			glmat[3] = glmat[7] = glmat[11] = 0.0f;
			glmat[15] = 1.0f;

			SetWorldMatrix ( g_iValue, ( D3DXMATRIX* ) &glmat );
			sObject* pObject = dbGetObject ( g_iValue++ );
			pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
		}

		//dbPositionObject ( g_iValue, glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );

	
	}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:47,代码来源:PhysXWrapper.cpp

示例2: SetupGLMatrix

void SetupGLMatrix(const NxVec3& pos, const NxMat33& orient)
{
	float glmat[16];	//4x4 column major matrix for OpenGL.
	orient.getColumnMajorStride4(&(glmat[0]));
	pos.get(&(glmat[12]));

	//clear the elements we don't need:
	glmat[3] = glmat[7] = glmat[11] = 0.0f;
	glmat[15] = 1.0f;

	glMultMatrixf(&(glmat[0]));
}
开发者ID:bitllorent,项目名称:CompAnim_P3,代码行数:12,代码来源:DrawObjects.cpp

示例3: PhysUpdate

void PhysUpdate ( void )
{
	int iObject = 1;

    // Render all the actors in the scene
    int nbActors = gScene->getNbActors();
    NxActor** actors = gScene->getActors();

	while (nbActors--)
    {
        NxActor* actor = *actors++;

		// Get an OpenGL transform (float[16]) from a Novodex shape’s global pose     
		// (NxMat34)
		NxShape* shape = NULL;

		NxMat34 pose = actor->getGlobalPose();

		NxMat33 orient = pose.M;
		NxVec3 pos = pose.t;	

		float glmat[16];    // 4x4 column major OpenGL matrix
		orient.getColumnMajorStride4(&(glmat[0]));
		pos.get(&(glmat[12]));

		// clear the elements we don't need:
		glmat[3] = glmat[7] = glmat[11] = 0.0f;
		glmat[15] = 1.0f;

		{
			sPhysObject* pPhys = ( sPhysObject* ) actor->userData;
			
			if ( pPhys )
			{
				SetWorldMatrix ( pPhys->iID, ( D3DXMATRIX* ) &glmat );

				sObject* pObject = dbGetObject ( pPhys->iID );

				pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
			}
		}
    }
}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:43,代码来源:PhysXWrapper.cpp

示例4: g

float * NovodexPhysicSystem::getGravity() const
{
	static NxVec3 g(0,0,0);
	m_scene->getGravity(g);
	return g.get();
}
开发者ID:irov,项目名称:Mengine,代码行数:6,代码来源:NovodexPhysicSystem.cpp

示例5: TickCar

void TickCar ( void )
{
	g_iValue = 10;

	NxReal steeringAngle = gSteeringValue * gMaxSteeringAngle;

	NxArray<CarWheelContact>::iterator i = wheelContactPoints.begin();
	while(i != wheelContactPoints.end())
	{
		CarWheelContact& cwc = *i;

		WheelShapeUserData* wheelData = (WheelShapeUserData *)(cwc.wheel->userData);

		/*
		struct CarWheelContact
		{
			NxActor* car;
			NxShape* wheel;
			NxVec3 contactPoint;
			NxVec3 contactNormalForce;
			NxVec3 contactFrictionForce;
		};
		*/

		{
			NxMat34 pose   = cwc.wheel->getGlobalPose ( );
			NxMat33 orient = pose.M;
			NxVec3  pos    = pose.t;

			float glmat[16];
			orient.getColumnMajorStride4(&(glmat[0]));
			pos.get(&(glmat[12]));
			glmat[3] = glmat[7] = glmat[11] = 0.0f;
			glmat[15] = 1.0f;

			SetWorldMatrix ( g_iValue, ( D3DXMATRIX* ) &glmat );
			sObject* pObject = dbGetObject ( g_iValue );
			pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );

			//dbPositionObject ( g_iValue, glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );

			g_iValue++;
		}

		//apply to powered wheels only.
		if (wheelData->frontWheel)
	    {
			//steering:
			NxMat33 wheelOrientation = cwc.wheel->getLocalOrientation();
			wheelOrientation.setColumn(0,  NxVec3(NxMath::cos(steeringAngle), 0,  NxMath::sin(steeringAngle) ));
			wheelOrientation.setColumn(2,  NxVec3(NxMath::sin(steeringAngle), 0, -NxMath::cos(steeringAngle) ));
			cwc.wheel->setLocalOrientation(wheelOrientation);

			if (frontWheelIsPowered)
			{
				//get the world space orientation:
				wheelOrientation = cwc.wheel->getGlobalOrientation();
				NxVec3 steeringDirection;
				wheelOrientation.getColumn(0, steeringDirection);

				//the power direction of the front wheel is the wheel's axis as it is steered.
				if (gMotorForce)
				{
					cwc.car->addForceAtPos(steeringDirection * gMotorForce,cwc.contactPoint);
				}
			}
		}
		if (!wheelData->frontWheel && rearWheelIsPowered)
		{
			//get the orientation of this car:
			NxMat33 m = cwc.car->getGlobalOrientation();
			NxVec3 carForwardAxis;
			m.getColumn(0, carForwardAxis);
			//the power direction of the rear wheel is always the car's length axis.
			cwc.car->addForceAtPos(carForwardAxis * gMotorForce,cwc.contactPoint);
		}
		i++;
	}

	wheelContactPoints.clear();
}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:81,代码来源:PhysXWrapper.cpp


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