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


C++ NxMat33::id方法代码示例

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


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

示例1: ApplyVelocityToActor

NxVec3 ApplyVelocityToActor(NxActor* actor, const NxVec3& velDir, const NxReal velStrength, bool velMode)
{
	NxVec3 velVec = velStrength*velDir;

	if (velMode) 
	{
		actor->moveGlobalPosition(actor->getGlobalPosition() + 0.0001*velStrength*velDir);
	} 
	else 
	{
		NxMat33 orient = actor->getGlobalOrientation();
        NxMat33 m;

		m.id();

		if (velDir == NxVec3(1,0,0))
           m.rotX(0.01);
		else if (velDir == NxVec3(-1,0,0))
           m.rotX(-0.01);
		else if (velDir == NxVec3(0,1,0))
           m.rotY(0.01);
		else if (velDir == NxVec3(0,-1,0))
           m.rotY(-0.01);
		else if (velDir == NxVec3(0,0,1))
           m.rotZ(0.01);
		else if (velDir == NxVec3(0,0,-1))
           m.rotZ(-0.01);

		orient = m * orient;

		actor->moveGlobalOrientation(orient);
	}

	return velVec;
}
开发者ID:1suming,项目名称:pap2,代码行数:35,代码来源:CommonCode.cpp

示例2: KeyboardUpCallback

void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
		case 'x': { bShadows = !bShadows; break; }
		case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }
		case 'c': { 
					// Reset the box
					NxMat33 m;
					m.id();
					box1->setGlobalOrientation(m);
					box1->setGlobalPosition(NxVec3(5,3.5,0));
					box1->setLinearVelocity(NxVec3(0,0,0));
					box1->setAngularVelocity(NxVec3(0,0,0));

					ChangeKernel();
					break; 
				  }
		case 27 : { exit(0); break; }
		default : { break; }
	}
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:31,代码来源:Lesson603.cpp

示例3: addAABB

void CCTDebugData::addAABB(const NxBounds3& bounds, NxU32 color, bool renderFrame)
{
	// Reuse OBB code...
	NxVec3 center;	bounds.getCenter(center);
	NxVec3 extents;	bounds.getExtents(extents);
	NxMat33 id;	id.id();
	addOBB(NxBox(center, extents, id), color, renderFrame);
}
开发者ID:jinfengswust,项目名称:badotter-ogitor-physx,代码行数:8,代码来源:CCTDebugRenderer.cpp

示例4: FindTouchedCCTs

void SweepTest::FindTouchedCCTs(	NxU32 nb_boxes, const NxExtendedBounds3* boxes, const void** box_user_data,
									NxU32 nb_capsules, const NxExtendedCapsule* capsules, const void** capsule_user_data,
									const NxExtendedBounds3& world_box)
{
	NxExtendedVec3 Origin;	// Will be TouchedGeom::mOffset
	world_box.getCenter(Origin);

	// Find touched boxes, i.e. other box controllers
	for(NxU32 i=0;i<nb_boxes;i++)
	{
		if(!world_box.intersect(boxes[i]))
			continue;

		TouchedUserBox* UserBox = (TouchedUserBox*)reserve(mGeomStream, sizeof(TouchedUserBox)/sizeof(NxU32));
		UserBox->mType		= TOUCHED_USER_BOX;
		UserBox->mUserData	= box_user_data[i];
		UserBox->mOffset	= Origin;
		UserBox->mBox		= boxes[i];
	}

	// Find touched capsules, i.e. other capsule controllers
	NxExtendedVec3 Center;
	NxVec3 Extents;
	world_box.getCenter(Center);
	world_box.getExtents(Extents);
	NxMat33 Idt;
	Idt.id();
	for(NxU32 i=0;i<nb_capsules;i++)
	{
		// Do a quick AABB check first, to avoid calling the SDK too much
		const NxF32 r = capsules[i].radius;
		if((capsules[i].p0.x - r > world_box.max.x) || (world_box.min.x > capsules[i].p1.x + r)) continue;
		if((capsules[i].p0.y - r > world_box.max.y) || (world_box.min.y > capsules[i].p1.y + r)) continue;
		if((capsules[i].p0.z - r > world_box.max.z) || (world_box.min.z > capsules[i].p1.z + r)) continue;

		// Do a box-capsule intersect, or skip it? => better to skip it, not really useful now
/*		NxCapsule tmp;
		tmp.radius = capsules[i].radius;
		tmp.p0.x = float(capsules[i].p0.x);
		tmp.p0.y = float(capsules[i].p0.y);
		tmp.p0.z = float(capsules[i].p0.z);
		tmp.p1.x = float(capsules[i].p1.x);
		tmp.p1.y = float(capsules[i].p1.y);
		tmp.p1.z = float(capsules[i].p1.z);
		float d2 = gUtilLib->NxSegmentOBBSqrDist(tmp, NxVec3(float(Center.x), float(Center.y), float(Center.z)), 
											Extents, 
											Idt, NULL, NULL);
		if(d2<capsules[i].radius*capsules[i].radius)*/
		{
			TouchedUserCapsule* UserCapsule = (TouchedUserCapsule*)reserve(mGeomStream, sizeof(TouchedUserCapsule)/sizeof(NxU32));
			UserCapsule->mType		= TOUCHED_USER_CAPSULE;
			UserCapsule->mUserData	= capsule_user_data[i];
			UserCapsule->mOffset	= Origin;
			UserCapsule->mCapsule	= capsules[i];
		}
	}
}
开发者ID:gbaumgart,项目名称:vt,代码行数:57,代码来源:CharacterController.cpp

示例5: CreateFFLinearKernel

NxForceFieldLinearKernel* CreateFFLinearKernel()
{
	// Create a Linear kernel
	NxMat33 m;
	m.id();

	NxForceFieldLinearKernelDesc lKernelDesc;
	lKernelDesc.positionMultiplier = m;
	lKernelDesc.positionTarget = NxVec3(0, 3.5, 0);

	gLinearKernel = gScene->createForceFieldLinearKernel(lKernelDesc);
	return gLinearKernel;
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:13,代码来源:Lesson603.cpp

示例6: ReconfigureD6Joint

// Reconfigure joint, a.k.a., roll joint
void ReconfigureD6Joint()
{
	NxActor* a0 = capsule1;
	NxActor* a1 = capsule2;

    NxD6JointDesc d6Desc;

    // Reset actor #1
    NxMat33 orient;
    orient.id();
    a1->raiseBodyFlag(NX_BF_KINEMATIC);
    a1->setGlobalOrientation(orient);
    a1->setGlobalPosition(NxVec3(0,3,0));
    a1->clearBodyFlag(NX_BF_KINEMATIC);

    d6Desc.actor[0] = a0;
    d6Desc.actor[1] = a1;

    // Reset Anchor and Axis
    NxVec3 globalAnchor = NxVec3(0,5,0);
    NxVec3 globalAxis = NxVec3(0,1,0);

    d6Desc.setGlobalAnchor(globalAnchor);
    d6Desc.setGlobalAxis(globalAxis);

	switch (gJointType) 
	{
		case 0:  // Translation Limited Joint 
		{
			d6Desc.twistMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_LOCKED;

			d6Desc.xMotion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.yMotion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.zMotion = NX_D6JOINT_MOTION_LIMITED;

	        d6Desc.linearLimit.value = 0.8;
	        d6Desc.linearLimit.restitution = 0;
	        d6Desc.linearLimit.spring = 0;
	        d6Desc.linearLimit.damping = 0;
		}
		break;

		case 1:  // Translation Soft Limited Joint 
		{ 
			d6Desc.twistMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_LOCKED;

			d6Desc.xMotion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.yMotion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.zMotion = NX_D6JOINT_MOTION_LIMITED;

	        d6Desc.linearLimit.value = 0.8;
	        d6Desc.linearLimit.restitution = 0;
	        d6Desc.linearLimit.spring = 100;
	        d6Desc.linearLimit.damping = 0.1;
		}
		break;

		case 2:  // Rotation Limited Joint 
		{ 
			d6Desc.twistMotion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_LIMITED;

			d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;

	        d6Desc.swing1Limit.value = 0.3*NxPi;
	        d6Desc.swing1Limit.restitution = 0;
	        d6Desc.swing1Limit.spring = 0;
	        d6Desc.swing1Limit.damping = 0;

	        d6Desc.swing2Limit.value = 0.3*NxPi;
	        d6Desc.swing2Limit.restitution = 0;
	        d6Desc.swing2Limit.spring = 0;
	        d6Desc.swing2Limit.damping = 0;

	        d6Desc.twistLimit.low.value = -0.05*NxPi;
	        d6Desc.twistLimit.low.restitution = 0;
	        d6Desc.twistLimit.low.spring = 0;
	        d6Desc.twistLimit.low.damping = 0;
			
			d6Desc.twistLimit.high.value = 0.05*NxPi;
	        d6Desc.twistLimit.high.restitution = 0;
	        d6Desc.twistLimit.high.spring = 0;
	        d6Desc.twistLimit.high.damping = 0;
		}
		break;

		case 3:  // Rotation Soft Limited Joint 
		{ 
			d6Desc.twistMotion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_LIMITED;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_LIMITED;

//.........这里部分代码省略.........
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:101,代码来源:Lesson211.cpp

示例7: sprintf

void World::ReconfigureD6Joint(NxD6Joint* d6Joint, NxActor* a0, NxActor* a1)
{
	NxD6JointDesc oldD6Desc, d6Desc;
	NxVec3 localAnchor[2], localAxis[2], localNormal[2], localBinormal[2];

	d6Joint->saveToDesc(oldD6Desc);

	localAnchor[0] = oldD6Desc.localAnchor[0];
	localAnchor[1] = oldD6Desc.localAnchor[1];

	localAxis[0] = oldD6Desc.localAxis[0];
	localNormal[0] = oldD6Desc.localNormal[0];
	localBinormal[0] = oldD6Desc.localNormal[0].cross(localAxis[0]);		// ???????

	localAxis[1] = oldD6Desc.localAxis[1];
	localNormal[1] = oldD6Desc.localNormal[1];
	localBinormal[1] = oldD6Desc.localNormal[0].cross(localAxis[1]);		// ???????

	switch (gJointType)
	{
		case 0:  // Fixed Joint 
		{  
			// Coming from spherical joint, so reset actor #1
			NxMat33 orient;
			orient.id();
			a1->raiseBodyFlag(NX_BF_KINEMATIC);
			a1->setGlobalOrientation(orient);
			a1->setGlobalPosition(NxVec3(0,3,0));
			a1->clearBodyFlag(NX_BF_KINEMATIC);

			d6Desc.actor[0] = a0;
			d6Desc.actor[1] = a1;

			// Reset anchor and axis
			NxVec3 globalAnchor = NxVec3(0,5,0);
			NxVec3 globalAxis = NxVec3(0,0,-1);

			d6Desc.setGlobalAnchor(globalAnchor);
			d6Desc.setGlobalAxis(globalAxis);

			d6Desc.twistMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_LOCKED;

			d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
		}
		break;
		case 1:  // Revolute Joint 
		{  
			d6Desc.actor[0] = a0;
			d6Desc.actor[1] = a1;
			d6Desc.localAnchor[0] = localAnchor[0];
			d6Desc.localAnchor[1] = localAnchor[1];
			d6Desc.localAxis[0] = localAxis[0];
			d6Desc.localNormal[0] = localNormal[0];
			d6Desc.localAxis[1] = localAxis[1];
			d6Desc.localNormal[1] = localNormal[1];

			d6Desc.twistMotion = NX_D6JOINT_MOTION_FREE;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_LOCKED;

			d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
		}
		break;

		case 2:  // Spherical Joint 
		{  
			d6Desc.actor[0] = a0;
			d6Desc.actor[1] = a1;

			d6Desc.localAnchor[0] = localAnchor[0];
			d6Desc.localAnchor[1] = localAnchor[1];
			d6Desc.localAxis[0] = localBinormal[0];
			d6Desc.localNormal[0] = localNormal[0];
			d6Desc.localAxis[1] = localBinormal[1];
			d6Desc.localNormal[1] = localNormal[1];

			d6Desc.twistMotion = NX_D6JOINT_MOTION_FREE;
			d6Desc.swing1Motion = NX_D6JOINT_MOTION_FREE;
			d6Desc.swing2Motion = NX_D6JOINT_MOTION_FREE;

			d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
			d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
		}
		break;
	};

	d6Desc.projectionMode = NX_JPM_NONE;

	// Set joint motion display values
	gJointMotion[3] = d6Desc.twistMotion;
	gJointMotion[4] = d6Desc.swing1Motion;
	gJointMotion[5] = d6Desc.swing2Motion;

//.........这里部分代码省略.........
开发者ID:binly,项目名称:TestPhysx,代码行数:101,代码来源:MyJoints.cpp

示例8: SetupPressureScene

void World::SetupPressureScene()
{
	// Create pressure cloth
	NxClothDesc clothDesc;
	clothDesc.globalPose.t = NxVec3(-2.5,0.1,0);
	
	clothDesc.thickness = 0.01f;
	clothDesc.pressure = 1.0f;
	clothDesc.stretchingStiffness = 1.0f;
	clothDesc.bendingStiffness = 0.5f;
	clothDesc.friction = 0.1;
	clothDesc.globalPose.M.rotY(-NxPi/6);

	clothDesc.density = 0.05f;
	clothDesc.flags |= NX_CLF_PRESSURE | NX_CLF_DAMPING;
	clothDesc.flags |= NX_CLF_BENDING | NX_CLF_COLLISION_TWOWAY | NX_CLF_VISUALIZATION;

	MyCloth* objCloth = new MyCloth(gScene, clothDesc, "data/newmesh.obj", 0.3);
	NxCloth* cloth = objCloth->getNxCloth();

	
	NxClothDesc clothDesc2;
	clothDesc2.globalPose.t = NxVec3(-6.8,0.1,0);
	clothDesc2.thickness = 0.01f;
	clothDesc2.pressure = 1.0f;
	clothDesc2.stretchingStiffness = 1.0f;
	clothDesc2.bendingStiffness = 0.5f;
	clothDesc2.friction = 0.1;
	clothDesc2.globalPose.M.rotY(-NxPi/6);

	clothDesc2.density = 0.05f;
	clothDesc2.flags |= NX_CLF_PRESSURE | NX_CLF_DAMPING;
	clothDesc2.flags |= NX_CLF_BENDING | NX_CLF_COLLISION_TWOWAY | NX_CLF_VISUALIZATION;

	MyCloth* objCloth2 = new MyCloth(gScene, clothDesc2, "data/newmesh.obj", 0.3);
	NxCloth* cloth2 = objCloth2->getNxCloth();


	// cloth3
	NxClothDesc clothDesc3;
	clothDesc3.globalPose.t = NxVec3(-4.65,0.1,3.6);
	clothDesc3.thickness = 0.01f;
	clothDesc3.pressure = 1.0f;
	clothDesc3.stretchingStiffness = 1.0f;
	clothDesc3.bendingStiffness = 0.5f;
	clothDesc3.friction = 0.1;
	clothDesc3.globalPose.M.rotY(-NxPi/6);

	clothDesc3.density = 0.05f;
	clothDesc3.flags |= NX_CLF_PRESSURE | NX_CLF_DAMPING;
	clothDesc3.flags |= NX_CLF_BENDING | NX_CLF_COLLISION_TWOWAY | NX_CLF_VISUALIZATION;

	MyCloth* objCloth3 = new MyCloth(gScene, clothDesc3, "data/newmesh.obj", 0.3);
	NxCloth* cloth3 = objCloth3->getNxCloth();
	
//-------------------------test---------------------
	NxVec3 maxPos, minPos;
	NxVec3 maxPos2, minPos2;
	NxVec3 maxPos3, minPos3;
	GetPos(maxPos, minPos, cloth);
	GetPos(maxPos2, minPos2, cloth2);
	GetPos(maxPos3, minPos3, cloth3);
	printf("cloth\nmaxPos %f %f %f\nminPos %f %f %f\n\n",maxPos.x, maxPos.y, maxPos.z, minPos.x, minPos.y, minPos.z);
	printf("cloth2\nmaxPos %f %f %f\nminPos %f %f %f\n",maxPos2.x, maxPos2.y, maxPos2.z, minPos2.x, minPos2.y, minPos2.z);
	printf("cloth3\nmaxPos %f %f %f\nminPos %f %f %f\n",maxPos3.x, maxPos3.y, maxPos3.z, minPos3.x, minPos3.y, minPos3.z);
	printf("width is %f  %f, height is %f\n",maxPos.x-minPos.x, maxPos.z-minPos.z, maxPos.y-minPos.y);

	NxVec3 pos1(minPos.x, maxPos.y, (maxPos.z + minPos.z)/2);
	NxVec3 pos2(minPos.x, minPos.y, (maxPos.z + minPos.z)/2);
	NxVec3 pos3(minPos.x, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2);

	NxVec3 pos4(minPos.x, maxPos.y, (maxPos.z + minPos.z)/2 - (maxPos.z-minPos.z)/4);
	NxVec3 pos5(minPos.x, minPos.y, (maxPos.z + minPos.z)/2 - (maxPos.z-minPos.z)/4);
	NxVec3 pos6(minPos.x, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2 - (maxPos.z-minPos.z)/4);

	NxVec3 pos7(minPos.x, maxPos.y, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4); 
	NxVec3 pos8(minPos.x, minPos.y, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4);
	NxVec3 pos9 (minPos.x, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4);
	printf("pos9.z is %f\n", (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4);

	NxReal adhereX1 = (minPos.x - maxPos2.x)/2;
	NxReal adhereX2 = (minPos.x - maxPos2.x)/2;

	NxActor* adhere1 = MyCreateCapsule(pos1, adhereX1, adhereX1, 1);
	NxActor* adhere2 = MyCreateCapsule(pos2, adhereX1, adhereX1, 1);
	NxActor* adhere3 = MyCreateCapsule(pos3, adhereX2, adhereX1, 1);

	NxActor* adhere4 = MyCreateCapsule(pos4, adhereX2, adhereX1, 1);
	NxActor* adhere5 = MyCreateCapsule(pos5, adhereX2, adhereX1, 1);
	NxActor* adhere6 = MyCreateCapsule(pos6, adhereX2, adhereX1, 1);

	NxActor* adhere7 = MyCreateCapsule(pos7, adhereX2, adhereX1, 1);
	NxActor* adhere8 = MyCreateCapsule(pos8, adhereX2, adhereX1, 1);
	NxActor* adhere9 = MyCreateCapsule(pos9, adhereX2, adhereX1, 1);


	NxQuat quat(90.0f, NxVec3(0,0,1));
	NxMat33 m;
	m.id();
	m.fromQuat(quat);
//.........这里部分代码省略.........
开发者ID:binly,项目名称:TestPhysx,代码行数:101,代码来源:MyCreateCloth.cpp

示例9: CreateSoftComb

void World::CreateSoftComb()
{
	NxReal combLength = 4.1709f, combWidth = 4.8161f, combHeight = 5.9620f;
	NxReal x_offset, z_offset = 0.0f;

	for (int i = 0; i < 3; i++)
	{
		NxClothDesc clothDesc;
		clothDesc.globalPose.t = NxVec3(-2.5 - i*combLength - 0.05, 0.1, 0);
		
		clothDesc.thickness = 0.01f;
		clothDesc.pressure = 1.0f;
		clothDesc.stretchingStiffness = 1.0f;
		clothDesc.bendingStiffness = 1.0f;
		clothDesc.friction = 0.1;
		clothDesc.collisionResponseCoefficient = 0.1f;
		clothDesc.globalPose.M.rotY(-NxPi/6);

		clothDesc.density = 0.05f;
		clothDesc.flags |= NX_CLF_PRESSURE | NX_CLF_DAMPING;
		clothDesc.flags |= NX_CLF_BENDING | NX_CLF_COLLISION_TWOWAY | NX_CLF_VISUALIZATION | NX_CLF_TRIANGLE_COLLISION;

		MyCloth* objCloth = new MyCloth(gScene, clothDesc, "data/newmesh.obj", 0.3);
		NxCloth* cloth = objCloth->getNxCloth();

		NxVec3 maxPos, minPos;
		GetPos(maxPos, minPos, cloth);
		x_offset = (maxPos.x - minPos.x) / 4;
		z_offset = (maxPos.z - minPos.z) / 4;
		printf("x_offset is %f\n", x_offset);

		NxVec3 pos1(minPos.x, maxPos.y, (maxPos.z + minPos.z)/2);	//mid-up   (fb ud)
		NxVec3 pos2(minPos.x, minPos.y, (maxPos.z + minPos.z)/2);	//mid-bottom
		NxVec3 pos3(minPos.x, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2);// mid-mid

		NxVec3 pos4(minPos.x, maxPos.y, (maxPos.z + minPos.z)/2 - (maxPos.z-minPos.z)/4); //back-up
		NxVec3 pos5(minPos.x, minPos.y, (maxPos.z + minPos.z)/2 - (maxPos.z-minPos.z)/4); //back-bottom
		NxVec3 pos6(minPos.x, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2 - (maxPos.z-minPos.z)/4); //back-mid

		NxVec3 pos7(minPos.x, maxPos.y, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4); //forward-up
		NxVec3 pos8(minPos.x, minPos.y, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4); //forward-bottom
		NxVec3 pos9(minPos.x, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4);	//forward-mid

		// new pos
		NxVec3 pos11(minPos.x + x_offset, maxPos.y, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4 + z_offset/2);
		NxVec3 pos22(minPos.x + x_offset, minPos.y, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4 + z_offset/2);
		NxVec3 pos33(minPos.x + x_offset, (maxPos.y+minPos.y)/2, (maxPos.z + minPos.z)/2 + (maxPos.z-minPos.z)/4 + z_offset/2);

		NxReal adhereX1 = 0.05f, adhereX2 = 0.05f, radius = 0.05f;
		NxActor* adhere1 = MyCreateCapsule(pos1, adhereX1, adhereX1, 1);
		NxActor* adhere2 = MyCreateCapsule(pos2, adhereX1, adhereX1, 1);
		NxActor* adhere3 = MyCreateCapsule(pos3, adhereX2, adhereX1, 1);

		NxActor* adhere4 = MyCreateCapsule(pos4, adhereX2, adhereX1, 1);
		NxActor* adhere5 = MyCreateCapsule(pos5, adhereX2, adhereX1, 1);
		NxActor* adhere6 = MyCreateCapsule(pos6, adhereX2, adhereX1, 1);

		NxActor* adhere7 = MyCreateCapsule(pos7, adhereX2, adhereX1, 1);
		NxActor* adhere8 = MyCreateCapsule(pos8, adhereX2, adhereX1, 1);
		NxActor* adhere9 = MyCreateCapsule(pos9, adhereX2, adhereX1, 1);

		NxActor* adhere10 = CreateSphere(pos11, radius, 1);
		NxActor* adhere11 = CreateSphere(pos22, radius, 1);
		NxActor* adhere12 = CreateSphere(pos33, radius, 1);

		adhere10->putToSleep();
		adhere11->putToSleep();
		adhere12->putToSleep();

		NxQuat quat(90.0f, NxVec3(0,0,1));
		NxMat33 m;
		m.id();
		m.fromQuat(quat);
		NxMat34 m34;
		m34.M = m;
		m34.t = adhere1->getGlobalPosition();
		adhere1->setGlobalPose(m34);
		m34.t = adhere2->getGlobalPosition();
		adhere2->setGlobalPose(m34);
		m34.t = adhere3->getGlobalPosition();
		adhere3->setGlobalPose(m34);
		m34.t = adhere4->getGlobalPosition();
		adhere4->setGlobalPose(m34);
		m34.t = adhere5->getGlobalPosition();
		adhere5->setGlobalPose(m34);
		m34.t = adhere6->getGlobalPosition();
		adhere6->setGlobalPose(m34);
		m34.t = adhere7->getGlobalPosition();
		adhere7->setGlobalPose(m34);
		m34.t = adhere8->getGlobalPosition();
		adhere8->setGlobalPose(m34);
		m34.t = adhere9->getGlobalPosition();
		adhere9->setGlobalPose(m34);

		cloth->attachToCollidingShapes(NX_CLOTH_ATTACHMENT_TWOWAY);
		gSelectedCloth = cloth;
		cloth->putToSleep();
		gCloths.push_back(objCloth);
	}

//.........这里部分代码省略.........
开发者ID:binly,项目名称:TestPhysx,代码行数:101,代码来源:MyCreateCloth.cpp


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