mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
PhysX: adding controller report callbacks.
This commit is contained in:
parent
70cea909c5
commit
b309198210
@ -44,6 +44,8 @@
|
|||||||
physxController.I physxController.h \
|
physxController.I physxController.h \
|
||||||
physxControllerDesc.I physxControllerDesc.h \
|
physxControllerDesc.I physxControllerDesc.h \
|
||||||
physxControllerReport.I physxControllerReport.h \
|
physxControllerReport.I physxControllerReport.h \
|
||||||
|
physxControllerShapeHit.I physxControllerShapeHit.h \
|
||||||
|
physxControllersHit.I physxControllersHit.h \
|
||||||
physxConvexForceFieldShape.I physxConvexForceFieldShape.h \
|
physxConvexForceFieldShape.I physxConvexForceFieldShape.h \
|
||||||
physxConvexForceFieldShapeDesc.I physxConvexForceFieldShapeDesc.h \
|
physxConvexForceFieldShapeDesc.I physxConvexForceFieldShapeDesc.h \
|
||||||
physxConvexMesh.I physxConvexMesh.h \
|
physxConvexMesh.I physxConvexMesh.h \
|
||||||
@ -173,6 +175,8 @@
|
|||||||
physxController.cxx \
|
physxController.cxx \
|
||||||
physxControllerDesc.cxx \
|
physxControllerDesc.cxx \
|
||||||
physxControllerReport.cxx \
|
physxControllerReport.cxx \
|
||||||
|
physxControllerShapeHit.cxx \
|
||||||
|
physxControllersHit.cxx \
|
||||||
physxConvexForceFieldShape.cxx \
|
physxConvexForceFieldShape.cxx \
|
||||||
physxConvexForceFieldShapeDesc.cxx \
|
physxConvexForceFieldShapeDesc.cxx \
|
||||||
physxConvexMesh.cxx \
|
physxConvexMesh.cxx \
|
||||||
@ -302,6 +306,8 @@
|
|||||||
physxController.I physxController.h \
|
physxController.I physxController.h \
|
||||||
physxControllerDesc.I physxControllerDesc.h \
|
physxControllerDesc.I physxControllerDesc.h \
|
||||||
physxControllerReport.I physxControllerReport.h \
|
physxControllerReport.I physxControllerReport.h \
|
||||||
|
physxControllerShapeHit.I physxControllerShapeHit.h \
|
||||||
|
physxControllersHit.I physxControllersHit.h \
|
||||||
physxConvexForceFieldShape.I physxConvexForceFieldShape.h \
|
physxConvexForceFieldShape.I physxConvexForceFieldShape.h \
|
||||||
physxConvexForceFieldShapeDesc.I physxConvexForceFieldShapeDesc.h \
|
physxConvexForceFieldShapeDesc.I physxConvexForceFieldShapeDesc.h \
|
||||||
physxConvexMesh.I physxConvexMesh.h \
|
physxConvexMesh.I physxConvexMesh.h \
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
#include "physxContactPair.h"
|
#include "physxContactPair.h"
|
||||||
#include "physxContactPoint.h"
|
#include "physxContactPoint.h"
|
||||||
#include "physxController.h"
|
#include "physxController.h"
|
||||||
|
#include "physxControllerReport.h"
|
||||||
|
#include "physxControllerShapeHit.h"
|
||||||
|
#include "physxControllersHit.h"
|
||||||
#include "physxConvexMesh.h"
|
#include "physxConvexMesh.h"
|
||||||
#include "physxConvexForceFieldShape.h"
|
#include "physxConvexForceFieldShape.h"
|
||||||
#include "physxConvexShape.h"
|
#include "physxConvexShape.h"
|
||||||
@ -131,6 +134,8 @@ init_libphysx() {
|
|||||||
PhysxContactPair::init_type();
|
PhysxContactPair::init_type();
|
||||||
PhysxContactPoint::init_type();
|
PhysxContactPoint::init_type();
|
||||||
PhysxController::init_type();
|
PhysxController::init_type();
|
||||||
|
PhysxControllerShapeHit::init_type();
|
||||||
|
PhysxControllersHit::init_type();
|
||||||
PhysxConvexMesh::init_type();
|
PhysxConvexMesh::init_type();
|
||||||
PhysxConvexForceFieldShape::init_type();
|
PhysxConvexForceFieldShape::init_type();
|
||||||
PhysxConvexShape::init_type();
|
PhysxConvexShape::init_type();
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "physxController.cxx"
|
#include "physxController.cxx"
|
||||||
#include "physxControllerDesc.cxx"
|
#include "physxControllerDesc.cxx"
|
||||||
#include "physxControllerReport.cxx"
|
#include "physxControllerReport.cxx"
|
||||||
|
#include "physxControllerShapeHit.cxx"
|
||||||
|
#include "physxControllersHit.cxx"
|
||||||
#include "physxConstraintDominance.cxx"
|
#include "physxConstraintDominance.cxx"
|
||||||
#include "physxConvexForceFieldShape.cxx"
|
#include "physxConvexForceFieldShape.cxx"
|
||||||
#include "physxConvexForceFieldShapeDesc.cxx"
|
#include "physxConvexForceFieldShapeDesc.cxx"
|
||||||
|
@ -34,3 +34,25 @@ INLINE PhysxControllerReport::
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerReport::set_shape_callback
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PhysxControllerReport::
|
||||||
|
set_shape_hit_callback(PT(CallbackObject) cbobj) {
|
||||||
|
|
||||||
|
_shape_hit_cbobj = cbobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerReport::set_shape_callback
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PhysxControllerReport::
|
||||||
|
set_controller_hit_callback(PT(CallbackObject) cbobj) {
|
||||||
|
|
||||||
|
_controller_hit_cbobj = cbobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ void PhysxControllerReport::
|
|||||||
enable() {
|
enable() {
|
||||||
|
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
|
|
||||||
|
_shape_hit_cbobj = NULL;
|
||||||
|
_controller_hit_cbobj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -63,13 +66,21 @@ onShapeHit( const NxControllerShapeHit& hit ) {
|
|||||||
|
|
||||||
_pcollector.start();
|
_pcollector.start();
|
||||||
|
|
||||||
if (1 && hit.shape) {
|
if (_shape_hit_cbobj) {
|
||||||
NxActor& actor = hit.shape->getActor();
|
// Callback
|
||||||
if (actor.isDynamic() && !actor.readBodyFlag(NX_BF_KINEMATIC)) {
|
PhysxControllerShapeHit cbdata(hit);
|
||||||
if (hit.dir.z == 0.0f) {
|
_shape_hit_cbobj->do_callback(&cbdata);
|
||||||
NxF32 controllerMass = hit.controller->getActor()->getMass();
|
}
|
||||||
NxF32 coeff = actor.getMass() * hit.length * controllerMass;
|
else {
|
||||||
actor.addForceAtLocalPos(hit.dir*coeff, NxVec3(0,0,0), NX_IMPULSE);
|
// Default implementation
|
||||||
|
if (1 && hit.shape) {
|
||||||
|
NxActor& actor = hit.shape->getActor();
|
||||||
|
if (actor.isDynamic() && !actor.readBodyFlag(NX_BF_KINEMATIC)) {
|
||||||
|
if (hit.dir.z == 0.0f) {
|
||||||
|
NxF32 controllerMass = hit.controller->getActor()->getMass();
|
||||||
|
NxF32 coeff = actor.getMass() * hit.length * controllerMass;
|
||||||
|
actor.addForceAtLocalPos(hit.dir*coeff, NxVec3(0,0,0), NX_IMPULSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,9 +104,17 @@ onControllerHit(const NxControllersHit& hit) {
|
|||||||
|
|
||||||
_pcollector.start();
|
_pcollector.start();
|
||||||
|
|
||||||
if (1 && hit.other) {
|
if (_controller_hit_cbobj) {
|
||||||
// For now other controllers are unpushable. --TODO--
|
// Callback
|
||||||
//return NX_ACTION_PUSH; is not implemented!
|
PhysxControllersHit cbdata(hit);
|
||||||
|
_controller_hit_cbobj->do_callback(&cbdata);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Default implementation
|
||||||
|
if (1 && hit.other) {
|
||||||
|
// For now other controllers are unpushable. --TODO--
|
||||||
|
//return NX_ACTION_PUSH; is not implemented!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_pcollector.stop();
|
_pcollector.stop();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#define PHYSXCONTROLLERREPORT_H
|
#define PHYSXCONTROLLERREPORT_H
|
||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
|
#include "callbackObject.h"
|
||||||
#include "pStatCollector.h"
|
#include "pStatCollector.h"
|
||||||
|
|
||||||
#include "physx_includes.h"
|
#include "physx_includes.h"
|
||||||
@ -35,11 +36,18 @@ public:
|
|||||||
void disable();
|
void disable();
|
||||||
bool is_enabled() const;
|
bool is_enabled() const;
|
||||||
|
|
||||||
|
INLINE void set_shape_hit_callback(PT(CallbackObject) cbobj);
|
||||||
|
INLINE void set_controller_hit_callback(PT(CallbackObject) cbobj);
|
||||||
|
|
||||||
virtual NxControllerAction onShapeHit(const NxControllerShapeHit& hit);
|
virtual NxControllerAction onShapeHit(const NxControllerShapeHit& hit);
|
||||||
virtual NxControllerAction onControllerHit(const NxControllersHit& hit);
|
virtual NxControllerAction onControllerHit(const NxControllersHit& hit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
|
|
||||||
|
PT(CallbackObject) _shape_hit_cbobj;
|
||||||
|
PT(CallbackObject) _controller_hit_cbobj;
|
||||||
|
|
||||||
static PStatCollector _pcollector;
|
static PStatCollector _pcollector;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
101
panda/src/physx/physxControllerShapeHit.I
Normal file
101
panda/src/physx/physxControllerShapeHit.I
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
// Filename: physxControllerShapeHit.I
|
||||||
|
// Created by: enn0x (28Nov12)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::Constructor
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PhysxControllerShapeHit::
|
||||||
|
PhysxControllerShapeHit(const NxControllerShapeHit &hit) :
|
||||||
|
_hit(hit) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::get_controller
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PhysxController *PhysxControllerShapeHit::
|
||||||
|
get_controller() const {
|
||||||
|
|
||||||
|
if (_hit.controller) {
|
||||||
|
return (PhysxController *)(_hit.controller->getUserData());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::get_shape
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PhysxShape *PhysxControllerShapeHit::
|
||||||
|
get_shape() const {
|
||||||
|
|
||||||
|
if (_hit.shape) {
|
||||||
|
return (PhysxShape *)(_hit.shape->userData);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::get_world_pos
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE LPoint3 PhysxControllerShapeHit::
|
||||||
|
get_world_pos() const {
|
||||||
|
|
||||||
|
return PhysxManager::nxExtVec3_to_point3(_hit.worldPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::get_world_normal
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE LVector3 PhysxControllerShapeHit::
|
||||||
|
get_world_normal() const {
|
||||||
|
|
||||||
|
return PhysxManager::nxVec3_to_vec3(_hit.worldNormal);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::get_dir
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE LVector3 PhysxControllerShapeHit::
|
||||||
|
get_dir() const {
|
||||||
|
|
||||||
|
return PhysxManager::nxVec3_to_vec3(_hit.dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllerShapeHit::get_length
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PN_stdfloat PhysxControllerShapeHit::
|
||||||
|
get_length() const {
|
||||||
|
|
||||||
|
return (PN_stdfloat)_hit.length;
|
||||||
|
}
|
||||||
|
|
19
panda/src/physx/physxControllerShapeHit.cxx
Normal file
19
panda/src/physx/physxControllerShapeHit.cxx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Filename: physxControllerShapeHit.cxx
|
||||||
|
// Created by: enn0x (28Nov12)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "physxControllerShapeHit.h"
|
||||||
|
|
||||||
|
TypeHandle PhysxControllerShapeHit::_type_handle;
|
||||||
|
|
||||||
|
|
71
panda/src/physx/physxControllerShapeHit.h
Normal file
71
panda/src/physx/physxControllerShapeHit.h
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// Filename: physxControllerShapeHit.h
|
||||||
|
// Created by: enn0x (28Nov12)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PHYSXCONTROLLERSHAPEHIT
|
||||||
|
#define PHYSXCONTROLLERSHAPEHIT
|
||||||
|
|
||||||
|
#include "pandabase.h"
|
||||||
|
#include "callbackData.h"
|
||||||
|
#include "callbackObject.h"
|
||||||
|
|
||||||
|
#include "physx_includes.h"
|
||||||
|
#include "physxManager.h"
|
||||||
|
|
||||||
|
class PhysxController;
|
||||||
|
class PhysxShape;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : PhysxControllerShapeHit
|
||||||
|
// Description :
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EXPCL_PANDAPHYSX PhysxControllerShapeHit : public CallbackData {
|
||||||
|
|
||||||
|
PUBLISHED:
|
||||||
|
INLINE PhysxControllerShapeHit(const NxControllerShapeHit &hit);
|
||||||
|
|
||||||
|
INLINE PhysxController *get_controller() const;
|
||||||
|
INLINE PhysxShape *get_shape() const;
|
||||||
|
INLINE LPoint3 get_world_pos() const;
|
||||||
|
INLINE LVector3 get_world_normal() const;
|
||||||
|
INLINE LVector3 get_dir() const;
|
||||||
|
INLINE PN_stdfloat get_length() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const NxControllerShapeHit &_hit;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
public:
|
||||||
|
static TypeHandle get_class_type() {
|
||||||
|
return _type_handle;
|
||||||
|
}
|
||||||
|
static void init_type() {
|
||||||
|
CallbackData::init_type();
|
||||||
|
register_type(_type_handle, "PhysxControllerShapeHit",
|
||||||
|
CallbackData::get_class_type());
|
||||||
|
}
|
||||||
|
virtual TypeHandle get_type() const {
|
||||||
|
return get_class_type();
|
||||||
|
}
|
||||||
|
virtual TypeHandle force_init_type() {
|
||||||
|
init_type();
|
||||||
|
return get_class_type();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static TypeHandle _type_handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "physxControllerShapeHit.I"
|
||||||
|
|
||||||
|
#endif // PHYSXCONTROLLERSHAPEHIT
|
53
panda/src/physx/physxControllersHit.I
Normal file
53
panda/src/physx/physxControllersHit.I
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Filename: physxControllersHit.I
|
||||||
|
// Created by: enn0x (28Nov12)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllersHit::Constructor
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PhysxControllersHit::
|
||||||
|
PhysxControllersHit(const NxControllersHit &hit) :
|
||||||
|
_hit(hit) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllersHit::get_controller
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PhysxController *PhysxControllersHit::
|
||||||
|
get_controller() const {
|
||||||
|
|
||||||
|
NxController *controllerPtr = _hit.controller;
|
||||||
|
PhysxController *controller = controllerPtr ? (PhysxController *)controllerPtr : NULL;
|
||||||
|
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxControllersHit::get_other
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PhysxController *PhysxControllersHit::
|
||||||
|
get_other() const {
|
||||||
|
|
||||||
|
NxController *otherPtr = _hit.other;
|
||||||
|
PhysxController *other = otherPtr ? (PhysxController *)otherPtr : NULL;
|
||||||
|
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
|
19
panda/src/physx/physxControllersHit.cxx
Normal file
19
panda/src/physx/physxControllersHit.cxx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Filename: physxControllersHit.cxx
|
||||||
|
// Created by: enn0x (28Nov12)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "physxControllersHit.h"
|
||||||
|
|
||||||
|
TypeHandle PhysxControllersHit::_type_handle;
|
||||||
|
|
||||||
|
|
65
panda/src/physx/physxControllersHit.h
Normal file
65
panda/src/physx/physxControllersHit.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// Filename: physxControllersHit.h
|
||||||
|
// Created by: enn0x (28Nov12)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PHYSXCONTROLLERSHIT
|
||||||
|
#define PHYSXCONTROLLERSHIT
|
||||||
|
|
||||||
|
#include "pandabase.h"
|
||||||
|
#include "callbackData.h"
|
||||||
|
#include "callbackObject.h"
|
||||||
|
|
||||||
|
#include "physx_includes.h"
|
||||||
|
|
||||||
|
class PhysxController;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : PhysxControllersHit
|
||||||
|
// Description :
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EXPCL_PANDAPHYSX PhysxControllersHit : public CallbackData {
|
||||||
|
|
||||||
|
PUBLISHED:
|
||||||
|
INLINE PhysxControllersHit(const NxControllersHit &hit);
|
||||||
|
|
||||||
|
INLINE PhysxController *get_controller() const;
|
||||||
|
INLINE PhysxController *get_other() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const NxControllersHit &_hit;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
public:
|
||||||
|
static TypeHandle get_class_type() {
|
||||||
|
return _type_handle;
|
||||||
|
}
|
||||||
|
static void init_type() {
|
||||||
|
CallbackData::init_type();
|
||||||
|
register_type(_type_handle, "PhysxControllersHit",
|
||||||
|
CallbackData::get_class_type());
|
||||||
|
}
|
||||||
|
virtual TypeHandle get_type() const {
|
||||||
|
return get_class_type();
|
||||||
|
}
|
||||||
|
virtual TypeHandle force_init_type() {
|
||||||
|
init_type();
|
||||||
|
return get_class_type();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static TypeHandle _type_handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "physxControllersHit.I"
|
||||||
|
|
||||||
|
#endif // PHYSXCONTROLLERSHIT
|
@ -69,3 +69,25 @@ ls(ostream &out, int indent_level) const {
|
|||||||
_softbodies.ls(out, indent_level);
|
_softbodies.ls(out, indent_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxScene::set_controller_shape_hit_callback
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PhysxScene::
|
||||||
|
set_controller_shape_hit_callback(PT(CallbackObject) cbobj) {
|
||||||
|
|
||||||
|
_controller_report.set_shape_hit_callback(cbobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PhysxScene::set_controller_controller_hit_callback
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PhysxScene::
|
||||||
|
set_controller_controller_hit_callback(PT(CallbackObject) cbobj) {
|
||||||
|
|
||||||
|
_controller_report.set_controller_hit_callback(cbobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "luse.h"
|
#include "luse.h"
|
||||||
|
#include "callbackObject.h"
|
||||||
|
|
||||||
#include "physxObject.h"
|
#include "physxObject.h"
|
||||||
#include "physxObjectCollection.h"
|
#include "physxObjectCollection.h"
|
||||||
@ -89,6 +90,9 @@ PUBLISHED:
|
|||||||
void enable_controller_reporting(bool enabled);
|
void enable_controller_reporting(bool enabled);
|
||||||
bool is_controller_reporting_enabled() const;
|
bool is_controller_reporting_enabled() const;
|
||||||
|
|
||||||
|
INLINE void set_controller_shape_hit_callback(PT(CallbackObject) cbobj);
|
||||||
|
INLINE void set_controller_controller_hit_callback(PT(CallbackObject) cbobj);
|
||||||
|
|
||||||
void set_gravity(const LVector3f &gravity);
|
void set_gravity(const LVector3f &gravity);
|
||||||
|
|
||||||
LVector3f get_gravity() const;
|
LVector3f get_gravity() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user