00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "physxControllerReport.h"
00016
00017 PStatCollector PhysxControllerReport::_pcollector("App:PhysX:Controller Reporting");
00018
00019
00020
00021
00022
00023
00024 void PhysxControllerReport::
00025 enable() {
00026
00027 _enabled = true;
00028 }
00029
00030
00031
00032
00033
00034
00035 void PhysxControllerReport::
00036 disable() {
00037
00038 _enabled = false;
00039 }
00040
00041
00042
00043
00044
00045
00046 bool PhysxControllerReport::
00047 is_enabled() const {
00048
00049 return _enabled;
00050 }
00051
00052
00053
00054
00055
00056
00057 NxControllerAction PhysxControllerReport::
00058 onShapeHit( const NxControllerShapeHit& hit ) {
00059
00060 if (!_enabled) {
00061 return NX_ACTION_NONE;
00062 }
00063
00064 _pcollector.start();
00065
00066 if (1 && hit.shape) {
00067 NxActor& actor = hit.shape->getActor();
00068 if (actor.isDynamic() && !actor.readBodyFlag(NX_BF_KINEMATIC)) {
00069 if (hit.dir.z == 0.0f) {
00070 NxF32 controllerMass = hit.controller->getActor()->getMass();
00071 NxF32 coeff = actor.getMass() * hit.length * controllerMass;
00072 actor.addForceAtLocalPos(hit.dir*coeff, NxVec3(0,0,0), NX_IMPULSE);
00073 }
00074 }
00075 }
00076
00077 _pcollector.stop();
00078
00079 return NX_ACTION_NONE;
00080 }
00081
00082
00083
00084
00085
00086
00087 NxControllerAction PhysxControllerReport::
00088 onControllerHit(const NxControllersHit& hit) {
00089
00090 if (!_enabled) {
00091 return NX_ACTION_NONE;
00092 }
00093
00094 _pcollector.start();
00095
00096 if (1 && hit.other) {
00097
00098
00099 }
00100
00101 _pcollector.stop();
00102
00103 return NX_ACTION_NONE;
00104 }
00105