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
RigidPhysObj.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\RigidPhysObj.cpp
Girar
Efecto
Propiedad
Historial
#include "RigidPhysObj.h" #include "GameScene.h" RigidPhysObj::RigidPhysObj(const String& nameResource, VisualObject* visualObject): PhysicalObject(visualObject),mActor(NULL){ initializing(nameResource);//at this stage, the pointer 'this' in Initializing method will be correct RebindToVisualObject(); } RigidPhysObj::RigidPhysObj(NxActor* actor, VisualObject* visualObject): PhysicalObject(visualObject),mActor(actor){ myassert(mActor!=NULL); RebindToVisualObject(); } RigidPhysObj::~RigidPhysObj(){ //SAFE_DELETE(mActor); //cannot delete the actor! //not need to release the actor, because the base class do it mActor->userData = NULL;//TODO: review this line GameScene::GetSingleton()->GetPhysicsScnene()->releaseActor(*mActor); } void RigidPhysObj::NXU_notifyActor(NxActor *actor, const char *userProperties){ LoadedPhysObj::NXU_notifyActor(actor,userProperties); myassert(mActor==NULL);//assert that there is only one actor, i.e. only one call to this function mActor = actor; } inline void RigidPhysObj::SetCollisionEnable(bool enabled){ if (enabled){ mActor->clearActorFlag(NX_AF_DISABLE_COLLISION); mActor->clearBodyFlag(NX_BF_KINEMATIC); } else{ mActor->raiseActorFlag(NX_AF_DISABLE_COLLISION); mActor->raiseBodyFlag(NX_BF_KINEMATIC); } } inline void RigidPhysObj::RegisterPhysicalEventHandler(PhysicalEventHandler* physicalEventHandler){ myassert(mActor->userData==NULL);//may be assigned multiple times mActor->userData = physicalEventHandler; } void RigidPhysObj::ApplyForce(const Vec3& force){ mActor->addForce(force,NxForceMode::NX_VELOCITY_CHANGE); } void RigidPhysObj::ApplyTorque(const Vec3& torque){ mActor->addTorque(torque,NxForceMode::NX_VELOCITY_CHANGE); } void RigidPhysObj::Stop(){ mActor->setLinearVelocity(Vec3(0,0,0)); mActor->setAngularVelocity(Vec3(0,0,0)); }
RigidPhysObj.cpp
Dirección de la página
Dirección del archivo
Anterior
40/55
Siguiente
Descargar
( 1 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.