NxU32 MoveCharacter(NxU32 characterIndex, NxScene& scene, const NxVec3& dispVector, NxF32 elapsedTime, NxU32 collisionGroups, NxF32 heightDelta)
{
	gNbPts = 0;

#ifndef DEBUG_CCT
	{
		//	NxF32 sharpness = 0.1f;
		NxF32 sharpness = 1.0f;

		NxU32 collisionFlags;
		NxVec3 d = dispVector*elapsedTime;
		if(heightDelta!=0.0f)
			d.y+=heightDelta;
		NxController* c = gManager->getController(characterIndex);
		c->move(d, collisionGroups, 0.000001f, collisionFlags, sharpness);
		return collisionFlags;
	}
#else
	{
		NxF32 sharpness = 1.0f;

		NxU32 collisionFlags;
		NxVec3 d = dispVector*elapsedTime;
		if(heightDelta!=0.0f)
			d.y+=heightDelta;

		d.y = 0.0f;

		NxController* c = gManager->getController(characterIndex);
		c->move(d, collisionGroups, 0.000001f, collisionFlags, sharpness);

		NxVec3 pos = c->getDebugPosition();

		d.x = d.z = 0.0f;
		d.y = -100.0f;

		NxU32 collisionFlags2;
		c->move(d, collisionGroups, 0.001f, collisionFlags2, sharpness);

		gLimitPos = c->getDebugPosition();

		c->setPosition(pos);

		return collisionFlags;
	}
#endif
}
Exemplo n.º 2
0
/***********************************************************
 move character
 returned collision flags, collection of NxControllerFlag
***********************************************************/
unsigned int PhysXEngine::MoveCharacter(unsigned int characterIndex, const NxVec3& moveVector)
{
	NxU32 collisionFlags;

	NxController* ctrl = gManager->getController(characterIndex);
	if(ctrl)
		ctrl->move(moveVector, COLLIDABLE_MASK, 0.000001f, collisionFlags);

	return collisionFlags;
}