x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
LoadedPhysObj.cpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\LoadedPhysObj.cpp
Girar
Efecto
Propiedad
Historial
#include "LoadedPhysObj.h" #include "GameScene.h" #include "RecordReplay.h" MyHashTable
LoadedPhysObj::physCollectionPool = MyHashTable
(); LoadedPhysObj::LoadedPhysObj(VisualObject* visualObject):PhysicalObject(visualObject){ //empty } LoadedPhysObj::LoadedPhysObj(const String& resourceName,VisualObject* visualObject): PhysicalObject(visualObject), mPhysCollection(NULL){ initializing(resourceName); } void LoadedPhysObj::initializing(const String& resourceName){ //load physical objects if (physCollectionPool.Exist(resourceName)){ mPhysCollection = physCollectionPool.Get(resourceName); }else{ mPhysCollection = loadCollection((".\\media\\"+resourceName+".xml").c_str(),NXU_FileType::FT_XML); myassert(mPhysCollection!=NULL); physCollectionPool.Put(resourceName, mPhysCollection); } NxMat34 instanceFrame(true); myassert(instanceFrame.isIdentity()); instanceFrame.t = NxVec3(0, 0, 0); //instanceFrame.t = mVisualObject->GetPosition(); instantiateCollection(mPhysCollection, *(GameScene::GetSingleton()->GetPhysicsSDK()), GameScene::GetSingleton()->GetPhysicsScnene(), &instanceFrame,this); tempNum = 0; } void LoadedPhysObj::NXU_notifyActor(NxActor *actor, const char *userProperties){ actorPool.Put(actor); } LoadedPhysObj::~LoadedPhysObj(){ //for (list
::iterator iter = physObjPool.GetPool().begin();iter!=physObjPool.GetPool().end();iter++){ // SAFE_DELETE(*iter); //} //physObjPool->Clear(); for (list
::iterator iter = actorPool.GetPool().begin();iter!=actorPool.GetPool().end();iter++){ NxActor* actor = *iter; GameScene::GetSingleton()->GetPhysicsScnene()->releaseActor(**iter); } actorPool.Clear(); } void LoadedPhysObj::SetCollisionEnable(bool enabled, const Vec3& direction){ //Vec3 dieDirection(Vec3((randomGenerator->Rand()%100)/10.0f-5.0f,(randomGenerator->Rand()%100)/10.0f-5.0f,2.0f)); for (list
::iterator iter = actorPool.GetPool().begin();iter!=actorPool.GetPool().end();iter++){ NxActor* actor = *iter; if (enabled){ tempNum--; //actor->wakeUp(); actor->clearActorFlag(NX_AF_DISABLE_COLLISION); actor->clearActorFlag(NX_AF_DISABLE_RESPONSE); actor->clearBodyFlag(NX_BF_DISABLE_GRAVITY); actor->clearBodyFlag(NX_BF_KINEMATIC); actor->setLinearVelocity(direction); actor->setAngularVelocity(Vec3(0,0,0)); actor->wakeUp(); //actor->setGroup(0); }else{ tempNum++; //actor->setGroup(10); actor->raiseActorFlag(NX_AF_DISABLE_COLLISION); actor->raiseActorFlag(NX_AF_DISABLE_RESPONSE); actor->raiseBodyFlag(NX_BF_DISABLE_GRAVITY); actor->setLinearVelocity(Vec3(0,0,0)); actor->setAngularVelocity(Vec3(0,0,0)); actor->raiseBodyFlag(NX_BF_KINEMATIC);//set velocity to zero actor->putToSleep();//put to inactive state to save CPU } } if (enabled){ if (tempNum!=0){ int aaaa=0; } } }
LoadedPhysObj.cpp
Dirección de la página
Dirección del archivo
Anterior
27/55
Siguiente
Descargar
( 2 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.