16 PStatCollector PhysxControllerReport::_pcollector(
"App:PhysX:Controller Reporting");
21 void PhysxControllerReport::
26 _shape_hit_cbobj =
nullptr;
27 _controller_hit_cbobj =
nullptr;
33 void PhysxControllerReport::
42 bool PhysxControllerReport::
51 NxControllerAction PhysxControllerReport::
52 onShapeHit(
const NxControllerShapeHit& hit ) {
55 return NX_ACTION_NONE;
60 if (_shape_hit_cbobj) {
63 _shape_hit_cbobj->do_callback(&cbdata);
68 NxActor& actor = hit.shape->getActor();
69 if (actor.isDynamic() && !actor.readBodyFlag(NX_BF_KINEMATIC)) {
70 if (hit.dir.z == 0.0f) {
71 NxF32 controllerMass = hit.controller->getActor()->getMass();
72 NxF32 coeff = actor.getMass() * hit.length * controllerMass;
73 actor.addForceAtLocalPos(hit.dir*coeff, NxVec3(0,0,0), NX_IMPULSE);
81 return NX_ACTION_NONE;
87 NxControllerAction PhysxControllerReport::
88 onControllerHit(
const NxControllersHit& hit) {
91 return NX_ACTION_NONE;
96 if (_controller_hit_cbobj) {
99 _controller_hit_cbobj->do_callback(&cbdata);
103 if (1 && hit.other) {
111 return NX_ACTION_NONE;
A lightweight class that represents a single element that may be timed and/or counted via stats.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.