31 PStatCollector PhysxScene::_pcollector_fetch_results(
"App:PhysX:Fetch Results");
32 PStatCollector PhysxScene::_pcollector_update_transforms(
"App:PhysX:Update Transforms");
33 PStatCollector PhysxScene::_pcollector_debug_renderer(
"App:PhysX:Debug Renderer");
34 PStatCollector PhysxScene::_pcollector_simulate(
"App:PhysX:Simulate");
36 PStatCollector PhysxScene::_pcollector_softbody(
"App:PhysX:Softbody");
42 link(NxScene *scenePtr) {
46 _ptr->userData =
this;
50 _cm = NxCreateControllerManager(NxGetPhysicsSDKAllocator());
54 NxMaterial *materials[5];
57 while (NxU32 i=_ptr->getMaterialArray(materials, 5, iterator)) {
60 material->link(materials[i]);
72 for (
unsigned int i=0; i < _vehicles.size(); i++) {
73 _vehicles[i]->release();
77 NxU32 nControllers = _cm->getNbControllers();
79 for (NxU32 i=0; i < nControllers; i++) {
80 NxController *controllerPtr = _cm->getController(i);
86 NxActor **actors = _ptr->getActors();
87 NxU32 nActors = _ptr->getNbActors();
89 for (NxU32 i=0; i < nActors; i++) {
99 NxU32 nJoints = _ptr->getNbJoints();
101 _ptr->resetJointIterator();
102 for (NxU32 i=0; i < nJoints; i++) {
103 NxJoint *jointPtr = _ptr->getNextJoint();
109 NxForceField **fields = _ptr->getForceFields();
110 NxU32 nFields = _ptr->getNbForceFields();
112 for (NxU32 i=0; i < nFields; i++) {
118 NxU32 nGroups = _ptr->getNbForceFieldShapeGroups();
120 _ptr->resetForceFieldShapeGroupsIterator();
121 for (NxU32 i=0; i < nGroups; i++) {
122 NxForceFieldShapeGroup *groupPtr = _ptr->getNextForceFieldShapeGroup();
128 NxCloth **cloths = _ptr->getCloths();
129 NxU32 nCloths = _ptr->getNbCloths();
131 for (NxU32 i=0; i < nCloths; i++) {
137 NxSoftBody **softbodies = _ptr->getSoftBodies();
138 NxU32 nSoftbodies = _ptr->getNbSoftBodies();
140 for (NxU32 i=0; i < nSoftbodies; i++) {
146 NxMaterial *materials[5];
149 while (NxU32 i=_ptr->getMaterialArray(materials, 5, iterator)) {
157 _cm->purgeControllers();
158 NxReleaseControllerManager(_cm);
160 _ptr->userData =
nullptr;
161 _error_type = ET_released;
172 nassertv(_error_type == ET_ok);
175 NxPhysicsSDK *sdk = NxGetPhysicsSDK();
176 sdk->releaseScene(*_ptr);
191 nassertv(_error_type == ET_ok);
193 _pcollector_simulate.start();
196 for (
unsigned int i=0; i < _vehicles.size(); i++) {
198 vehicle->update_vehicle(dt);
202 for (NxU32 i=0; i < _cm->getNbControllers(); i++) {
203 NxController *controllerPtr = _cm->getController(i);
205 controller->update_controller(dt);
208 _cm->updateControllers();
214 _pcollector_simulate.stop();
228 nassertv(_error_type == ET_ok);
229 nassertv(_ptr !=
nullptr);
231 _pcollector_fetch_results.start();
232 _ptr->fetchResults(NX_RIGID_BODY_FINISHED,
true);
233 _pcollector_fetch_results.stop();
236 _pcollector_update_transforms.start();
238 NxU32 nbTransforms = 0;
239 NxActiveTransform *activeTransforms = _ptr->getActiveTransforms(nbTransforms);
241 if (nbTransforms && activeTransforms) {
242 for (NxU32 i=0; i<nbTransforms; ++i) {
246 void *userData = activeTransforms[i].userData;
254 _pcollector_update_transforms.stop();
257 _pcollector_debug_renderer.start();
258 _debugNode->update(_ptr);
259 _pcollector_debug_renderer.stop();
261 nassertv(_ptr->isWritable());
264 _pcollector_cloth.start();
266 NxCloth **cloths = _ptr->getCloths();
267 for (NxU32 i=0; i < _ptr->getNbCloths(); i++) {
272 _pcollector_cloth.stop();
275 _pcollector_softbody.start();
277 NxSoftBody **softbodies = _ptr->getSoftBodies();
278 for (NxU32 i=0; i < _ptr->getNbSoftBodies(); i++) {
283 _pcollector_softbody.stop();
292 nassertv(_error_type == ET_ok);
293 _ptr->setTiming(0, 0, NX_TIMESTEP_VARIABLE);
311 nassertv(_error_type == ET_ok);
312 _ptr->setTiming(maxTimestep, maxIter, NX_TIMESTEP_FIXED);
321 nassertv(_error_type == ET_ok);
322 nassertv_always(!gravity.is_nan());
333 nassertr(_error_type == ET_ok, LVector3f::zero());
336 _ptr->getGravity(gravity);
343 unsigned int PhysxScene::
344 get_num_actors()
const {
346 nassertr(_error_type == ET_ok,-1);
348 return _ptr->getNbActors();
357 nassertr(_error_type == ET_ok,
nullptr);
361 nassertr(actor,
nullptr);
363 NxActor *actorPtr = _ptr->createActor(desc._desc);
364 nassertr(actorPtr,
nullptr);
366 actor->link(actorPtr);
375 get_actor(
unsigned int idx)
const {
377 nassertr(_error_type == ET_ok,
nullptr);
378 nassertr_always(idx < _ptr->getNbActors(),
nullptr);
380 NxActor *actorPtr = _ptr->getActors()[idx];
398 nassertr(_error_type == ET_ok,
nullptr);
406 enable_contact_reporting(
bool enabled) {
408 nassertv(_error_type == ET_ok);
411 _ptr->setUserContactReport(&_contact_report);
412 _contact_report.enable();
415 _ptr->setUserContactReport(
nullptr);
416 _contact_report.disable();
424 is_contact_reporting_enabled()
const {
426 nassertr(_error_type == ET_ok,
false);
428 return _contact_report.is_enabled();
435 enable_trigger_reporting(
bool enabled) {
437 nassertv(_error_type == ET_ok);
440 _ptr->setUserTriggerReport(&_trigger_report);
441 _trigger_report.enable();
444 _ptr->setUserTriggerReport(
nullptr);
445 _trigger_report.disable();
453 is_trigger_reporting_enabled()
const {
455 nassertr(_error_type == ET_ok,
false);
457 return _trigger_report.is_enabled();
464 enable_controller_reporting(
bool enabled) {
466 nassertv(_error_type == ET_ok);
469 _controller_report.enable();
472 _controller_report.disable();
480 is_controller_reporting_enabled()
const {
482 nassertr(_error_type == ET_ok,
false);
484 return _controller_report.is_enabled();
495 unsigned int PhysxScene::
496 get_num_materials()
const {
498 nassertr(_error_type == ET_ok, -1);
499 return _ptr->getNbMaterials();
513 nassertr(_error_type == ET_ok,
nullptr);
517 nassertr(material,
nullptr);
519 NxMaterial *materialPtr = _ptr->createMaterial(desc._desc);
520 nassertr(materialPtr,
nullptr);
522 material->link(materialPtr);
534 nassertr(_error_type == ET_ok,
nullptr);
537 nassertr(material,
nullptr);
541 NxMaterial *materialPtr = _ptr->createMaterial(desc);
542 nassertr(materialPtr,
nullptr);
544 material->link(materialPtr);
558 nassertr(_error_type == ET_ok, -1);
559 return _ptr->getHighestMaterialIndex();
573 nassertr(_error_type == ET_ok,
nullptr);
575 NxMaterial *materialPtr = _ptr->getMaterialFromIndex(idx);
587 nassertr(_error_type == ET_ok,
nullptr);
588 nassertr_always(idx < _ptr->getNbMaterials(),
nullptr);
590 NxU32 n = _ptr->getNbMaterials();
591 NxMaterial **materials =
new NxMaterial *[n];
595 materialCount = _ptr->getMaterialArray(materials, n, iterator);
596 nassertr((materialCount == n),
nullptr);
598 NxMaterial *materialPtr = materials[idx];
607 unsigned int PhysxScene::
608 get_num_controllers()
const {
610 nassertr(_error_type == ET_ok, -1);
611 return _cm->getNbControllers();
621 nassertr(_error_type == ET_ok,
nullptr);
622 nassertr(desc.is_valid(),
nullptr);
624 PhysxController *controller = PhysxController::factory(desc.ptr()->getType());
625 nassertr(controller,
nullptr);
627 desc.ptr()->callback = &_controller_report;
628 desc.ptr()->userData = controller;
630 NxController *controllerPtr = _cm->createController(_ptr,*desc.ptr());
631 nassertr(controllerPtr,
nullptr);
633 controller->link(controllerPtr);
634 controller->get_actor()->set_name(
"");
645 nassertr(_error_type == ET_ok,
nullptr);
646 nassertr_always(idx < _cm->getNbControllers(),
nullptr);
648 NxController *controllerPtr = _cm->getController(idx);
658 unsigned int PhysxScene::
659 get_num_joints()
const {
661 nassertr(_error_type == ET_ok, -1);
662 return _ptr->getNbJoints();
671 nassertr(_error_type == ET_ok,
nullptr);
672 nassertr(desc.is_valid(),
nullptr);
674 PhysxJoint *joint = PhysxJoint::factory(desc.ptr()->getType());
675 nassertr(joint,
nullptr);
677 NxJoint *jointPtr = _ptr->createJoint(*desc.ptr());
678 nassertr(jointPtr,
nullptr);
680 joint->link(jointPtr);
691 nassertr(_error_type == ET_ok,
nullptr);
692 nassertr_always(idx < _ptr->getNbJoints(),
nullptr);
695 NxU32 nJoints = _ptr->getNbJoints();
697 _ptr->resetJointIterator();
698 for (NxU32 i=0; i <= idx; i++) {
699 jointPtr = _ptr->getNextJoint();
708 unsigned int PhysxScene::
709 get_num_force_fields()
const {
711 nassertr(_error_type == ET_ok, -1);
712 return _ptr->getNbForceFields();
721 nassertr(_error_type == ET_ok,
nullptr);
724 desc.create_kernel(_ptr);
729 nassertr(field,
nullptr);
731 NxForceField *fieldPtr = _ptr->createForceField(desc._desc);
732 nassertr(fieldPtr,
nullptr);
734 field->link(fieldPtr);
746 nassertr(_error_type == ET_ok,
nullptr);
747 nassertr_always(idx < _ptr->getNbForceFields(),
nullptr);
749 NxForceField **fields = _ptr->getForceFields();
750 NxForceField *fieldPtr = fields[idx];
758 unsigned int PhysxScene::
759 get_num_force_field_shape_groups()
const {
761 nassertr(_error_type == ET_ok, -1);
762 return _ptr->getNbForceFieldShapeGroups();
771 nassertr(_error_type == ET_ok,
nullptr);
774 nassertr(group,
nullptr);
776 NxForceFieldShapeGroup *groupPtr = _ptr->createForceFieldShapeGroup(desc._desc);
777 nassertr(groupPtr,
nullptr);
779 group->link(groupPtr);
790 nassertr(_error_type == ET_ok,
nullptr);
791 nassertr_always(idx < _ptr->getNbForceFieldShapeGroups(),
nullptr);
793 _ptr->resetForceFieldShapeGroupsIterator();
794 NxForceFieldShapeGroup *groupPtr =
nullptr;
797 groupPtr = _ptr->getNextForceFieldShapeGroup();
806 unsigned int PhysxScene::
807 get_num_cloths()
const {
809 nassertr(_error_type == ET_ok, -1);
810 return _ptr->getNbCloths();
819 nassertr(_error_type == ET_ok,
nullptr);
822 nassertr(cloth,
nullptr);
824 NxCloth *clothPtr = _ptr->createCloth(desc._desc);
825 nassertr(clothPtr,
nullptr);
827 cloth->link(clothPtr);
838 nassertr(_error_type == ET_ok,
nullptr);
839 nassertr_always(idx < _ptr->getNbCloths(),
nullptr);
841 NxCloth **cloths = _ptr->getCloths();
842 NxCloth *clothPtr = cloths[idx];
850 unsigned int PhysxScene::
851 get_num_soft_bodies()
const {
853 nassertr(_error_type == ET_ok, -1);
854 return _ptr->getNbSoftBodies();
863 nassertr(_error_type == ET_ok,
nullptr);
866 nassertr(softbody,
nullptr);
868 NxSoftBody *softbodyPtr = _ptr->createSoftBody(desc._desc);
869 nassertr(softbodyPtr,
nullptr);
871 softbody->link(softbodyPtr);
883 nassertr(_error_type == ET_ok,
nullptr);
884 nassertr_always(idx < _ptr->getNbSoftBodies(),
nullptr);
886 NxSoftBody **softbodies = _ptr->getSoftBodies();
887 NxSoftBody *softbodyPtr = softbodies[idx];
895 unsigned int PhysxScene::
896 get_num_vehicles()
const {
898 nassertr(_error_type == ET_ok, -1);
899 return _vehicles.size();
908 nassertr(_error_type == ET_ok,
nullptr);
912 nassertr(vehicle,
nullptr);
914 vehicle->create(
this, desc);
925 nassertr(_error_type == ET_ok,
nullptr);
926 nassertr_always(idx < _vehicles.size(),
nullptr);
928 return _vehicles[idx];
937 nassertr(_error_type == ET_ok,
nullptr);
946 PhysxShapesType shapesType,
950 nassertr(_error_type == ET_ok,
false);
952 NxGroupsMask *groupsPtr = groups ? &(groups->_mask) :
nullptr;
954 return _ptr->raycastAnyShape(ray._ray, (NxShapesType)shapesType,
955 mask.get_mask(), ray._length, groupsPtr);
964 PhysxShapesType shapesType,
970 nassertr(_error_type == ET_ok, hit);
972 NxGroupsMask *groupsPtr = groups ? &(groups->_mask) :
nullptr;
974 NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE;
975 if (smoothNormal ==
true) {
976 hints |= NX_RAYCAST_NORMAL;
979 hints |= NX_RAYCAST_FACE_NORMAL;
982 _ptr->raycastClosestShape(ray._ray, (NxShapesType)shapesType, hit,
983 mask.get_mask(), ray._length, hints, groupsPtr);
995 PhysxShapesType shapesType,
1001 nassertr(_error_type == ET_ok, report);
1003 NxGroupsMask *groupsPtr = groups ? &(groups->_mask) :
nullptr;
1005 NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE;
1006 if (smoothNormal ==
true) {
1007 hints |= NX_RAYCAST_NORMAL;
1010 hints |= NX_RAYCAST_FACE_NORMAL;
1013 _ptr->raycastAllShapes(ray._ray, report, (NxShapesType)shapesType,
1014 mask.get_mask(), ray._length, hints, groupsPtr);
1025 PhysxShapesType shapesType,
1029 nassertr(_error_type == ET_ok,
false);
1031 NxGroupsMask *groupsPtr = groups ? &(groups->_mask) :
nullptr;
1033 return _ptr->raycastAnyBounds(ray._ray, (NxShapesType)shapesType,
1034 mask.get_mask(), ray._length, groupsPtr);
1047 nassertr(_error_type == ET_ok, hit);
1049 NxGroupsMask *groupsPtr = groups ? &(groups->_mask) :
nullptr;
1051 NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE;
1052 if (smoothNormal ==
true) {
1053 hints |= NX_RAYCAST_NORMAL;
1056 hints |= NX_RAYCAST_FACE_NORMAL;
1059 _ptr->raycastClosestBounds(ray._ray, (NxShapesType)shapesType, hit,
1060 mask.get_mask(), ray._length, hints, groupsPtr);
1073 PhysxShapesType shapesType,
1079 nassertr(_error_type == ET_ok, report);
1081 NxGroupsMask *groupsPtr = groups ? &(groups->_mask) :
nullptr;
1083 NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE;
1084 if (smoothNormal ==
true) {
1085 hints |= NX_RAYCAST_NORMAL;
1088 hints |= NX_RAYCAST_FACE_NORMAL;
1091 _ptr->raycastAllBounds(ray._ray, report, (NxShapesType)shapesType,
1092 mask.get_mask(), ray._length, hints, groupsPtr);
1103 PhysxShapesType shapesType,
1104 PhysxMask mask,
bool accurateCollision)
const {
1108 nassertr(_error_type == ET_ok, report);
1112 _ptr->overlapSphereShapes(worldSphere, (NxShapesType)shapesType, 0,
nullptr, &report,
1113 mask.get_mask(),
nullptr, accurateCollision);
1124 PhysxShapesType shapesType,
1125 PhysxMask mask,
bool accurateCollision)
const {
1129 nassertr(_error_type == ET_ok, report);
1133 NxCapsule worldCapsule(segment, radius);
1135 _ptr->overlapCapsuleShapes(worldCapsule, (NxShapesType)shapesType, 0,
nullptr, &report,
1136 mask.get_mask(),
nullptr, accurateCollision);
1153 PhysxContactPairFlag flag,
bool value) {
1155 nassertv(_error_type == ET_ok);
1157 NxActor *ptrA = actorA.ptr();
1158 NxActor *ptrB = actorB.ptr();
1159 NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB);
1161 if (value ==
true) {
1168 _ptr->setActorPairFlags(*ptrA, *ptrB, flags);
1178 PhysxContactPairFlag flag) {
1180 nassertr(_error_type == ET_ok,
false);
1182 NxActor *ptrA = actorA.ptr();
1183 NxActor *ptrB = actorB.ptr();
1184 NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB);
1186 return (flags && flag) ? true :
false;
1197 nassertv(_error_type == ET_ok);
1199 NxShape *ptrA = shapeA.ptr();
1200 NxShape *ptrB = shapeB.ptr();
1201 NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB);
1203 if (value ==
true) {
1204 flags |= NX_IGNORE_PAIR;
1207 flags &= ~(NX_IGNORE_PAIR);
1210 _ptr->setShapePairFlags(*ptrA, *ptrB, flags);
1222 nassertr(_error_type == ET_ok,
false);
1224 NxShape *ptrA = shapeA.ptr();
1225 NxShape *ptrB = shapeB.ptr();
1226 NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB);
1228 return (flags && NX_IGNORE_PAIR) ? true :
false;
1250 PhysxContactPairFlag flag,
bool value) {
1252 nassertv(_error_type == ET_ok);
1254 NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2);
1255 if (value ==
true) {
1261 _ptr->setActorGroupPairFlags(g1, g2, flags);
1269 PhysxContactPairFlag flag) {
1271 nassertr(_error_type == ET_ok,
false);
1272 NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2);
1273 return (flags && flag) ? true :
false;
1282 nassertv(_error_type == ET_ok);
1283 _ptr->setFilterOps((NxFilterOp)op0, (NxFilterOp)op1, (NxFilterOp)op2);
1292 nassertv(_error_type == ET_ok);
1293 _ptr->setFilterBool(flag);
1302 nassertv(_error_type == ET_ok);
1303 _ptr->setFilterConstant0(mask.get_mask());
1312 nassertv(_error_type == ET_ok);
1313 _ptr->setFilterConstant1(mask.get_mask());
1322 nassertr(_error_type == ET_ok,
false);
1323 return _ptr->getFilterBool();
1334 nassertr(_error_type == ET_ok, mask);
1336 NxGroupsMask _mask = ptr()->getFilterConstant0();
1337 mask.set_mask(_mask);
1350 nassertr(_error_type == ET_ok, mask);
1352 NxGroupsMask _mask = ptr()->getFilterConstant1();
1353 mask.set_mask(_mask);
1364 nassertr(_error_type == ET_ok, FO_and);
1370 _ptr->getFilterOps(op0, op1, op2);
1372 return (PhysxFilterOp)op0;
1381 nassertr(_error_type == ET_ok, FO_and);
1387 _ptr->getFilterOps(op0, op1, op2);
1389 return (PhysxFilterOp)op1;
1398 nassertr(_error_type == ET_ok, FO_and);
1404 _ptr->getFilterOps(op0, op1, op2);
1406 return (PhysxFilterOp)op2;
1424 nassertv(_error_type == ET_ok);
1425 nassertv(g1 >= 0 && g1 < 32);
1426 nassertv(g2 >= 0 && g2 < 32);
1428 _ptr->setGroupCollisionFlag((NxCollisionGroup)g1, (NxCollisionGroup)g2, enable);
1438 nassertr(_error_type == ET_ok,
false);
1439 nassertr(g1 >= 0 && g1 < 32,
false);
1440 nassertr(g2 >= 0 && g2 < 32,
false);
1442 return _ptr->getGroupCollisionFlag((NxCollisionGroup)g1, (NxCollisionGroup)g2);
1451 nassertr(_error_type == ET_ok,
false);
1452 return (_ptr->getFlags() & flag) ?
true :
false;
1462 nassertr(_error_type == ET_ok,
false);
1463 return (_ptr->getSimType() & NX_SIMULATION_HW) ?
true :
false;
1508 nassertv(_error_type == ET_ok);
1512 NxConstraintDominance d = dominance.get_dominance();
1513 _ptr->setDominanceGroupPair((NxDominanceGroup)g1, (NxDominanceGroup)g2, d);
1524 nassertr(_error_type == ET_ok, result);
1525 nassertr(g1 < 32, result);
1526 nassertr(g2 < 32, result);
1528 result.set_dominance(_ptr->getDominanceGroupPair((NxDominanceGroup)g1, (NxDominanceGroup)g2));
1544 nassertr(_error_type == ET_ok,
nullptr);
1546 if (_wheelShapeMaterial ==
nullptr) {
1548 materialDesc.
set_flag(PhysxMaterialDesc::MF_disable_friction,
true);
1552 return _wheelShapeMaterial;
Objects of this class are returned by the 'overlap shape' methods, for example overlapSphereShapes.
PhysxRaycastHit raycast_closest_bounds(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns the first axis aligned bounding box enclosing a shape that is hit along the ray.
bool get_group_collision_flag(unsigned int g1, unsigned int g2)
Determines if collision detection is performed between a pair of groups.
Descriptor class for materials.
PhysxMaterial * get_wheel_shape_material()
Gets the shared material for all wheel shapes.
void set_filter_constant1(const PhysxGroupsMask &mask)
Setups filtering's K1 value.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PhysxRaycastHit raycast_closest_shape(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns the first shape that is hit along the ray.
bool raycast_any_shape(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr) const
Returns true if any shape is intersected by the ray.
void set_group_collision_flag(unsigned int g1, unsigned int g2, bool enable)
Specifies if collision should be performed by a pair of shape groups.
bool raycast_any_bounds(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr) const
Returns true if any axis aligned bounding box enclosing a shape is intersected by the ray.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_flag(PhysxMaterialFlag flag, bool value)
Sets flags which control the behavior of a material.
bool is_valid() const
Returns true if the descriptor is valid.
PhysxGroupsMask get_filter_constant1() const
Gets filtering constant K1.
static PhysxManager * get_global_ptr()
Returns a pointer to the global PhysxManager object.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
Abstract base class for the different types of joints.
bool is_valid() const
Returns true if the descriptor is valid.
Abstract base class for shapes.
void set_filter_bool(bool flag)
Setups filtering's boolean value.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Descriptor for PhysxCloth.
bool is_valid() const
Returns true if the descriptor is valid.
Abstract base class for joint descriptors.
PhysxSoftBody * create_soft_body(PhysxSoftBodyDesc &desc)
Creates a soft body in this scene.
Descriptor class for force fields.
void set_filter_constant0(const PhysxGroupsMask &mask)
Setups filtering's K0 value.
void update_transform(const LMatrix4f &m)
Updates the transform of an assigned NodePath.
PhysxGroupsMask get_filter_constant0() const
Gets filtering constant K0.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool get_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, PhysxContactPairFlag flag)
Retrieves a single flag for the given pair of actors.
get_force_field_shape_group
Returns the n-th force field shape group in this scene.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_cloth
Returns the n-th cloth from the array of all the cloths in the scene.
A class for describing a shape's surface properties.
PhysxCloth * create_cloth(PhysxClothDesc &desc)
Creates a cloth in this scene.
PhysxRaycastReport raycast_all_shapes(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns a PhysxRaycastReport object which can be used to iterate over all shapes that have been hit b...
Descriptor class for a character controller.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PhysxMaterial * get_material_from_index(unsigned int idx) const
Retrieves the material with the given material index.
void set_timing_variable()
Sets simulation timing parameters used in simulate.
This structure captures results for a single raycast query.
A lightweight class that represents a single element that may be timed and/or counted via stats.
get_soft_body
Returns the n-th soft body from the array of all the soft bodies in the scene.
bool get_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag)
Retrieves a single flag set with PhysxScene::set_actor_group_pair_flag()
get_controller
Retrieves the n-th controller within the scene.
PhysxForceFieldShapeGroup * create_force_field_shape_group(PhysxForceFieldShapeGroupDesc &desc)
Creates a new force field shape group in this scene.
bool is_hardware_scene() const
Returns TRUE if the the scene is simulated in hardware.
PhysxOverlapReport overlap_capsule_shapes(const LPoint3f &p0, const LPoint3f &p1, float radius, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), bool accurateCollision=true) const
Returns the set of shapes overlapped by the world-space capsule.
PhysxFilterOp get_filter_op1() const
Retrieves the op1 filtering operation.
PhysxConstraintDominance get_dominance_group_pair(unsigned int g1, unsigned int g2)
Samples the dominance matrix.
Abstract base class for character controllers.
Descriptor for PhysxSoftBody.
bool get_flag(PhysxSceneFlag flag) const
Return the specified scene flag flag.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_vehicle
Returns the n-th vehicle from the array of all the vehicles in the scene.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
get_joint
Retrieve the n-th joint from the array of all the joints in the scene.
void fetch_results()
Waits until the simulation has finished, and then updates the scene graph with with simulation result...
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Descriptor for PhysxActor.
void set_dominance_group_pair(unsigned int g1, unsigned int g2, PhysxConstraintDominance dominance)
Specifies the dominance behavior of constraints between two actors with two certain dominance groups.
Actors are the main simulation objects.
void set_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, PhysxContactPairFlag flag, bool value)
Sets the pair flags for the given pair of actors.
PhysxMaterial * create_material()
Creates a new PhysxMaterial using the default settings of PhysxMaterialDesc.
get_force_field
Returns the n-th force field from the array of all the force fields in the scene.
void set_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB, bool value)
Disables or enables contact generation for a pair of shapes.
PhysxFilterOp get_filter_op0() const
Retrieves the op0 filtering operation.
get_material
Retrieves the n-th material from the array of materials.
void set_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag, bool value)
With this method one can set contact reporting flags between actors belonging to a pair of groups.
PhysxJoint * create_joint(PhysxJointDesc &desc)
Creates a joint in this scene.
void simulate(float dt)
Advances the simulation by an elapsedTime time.
LVector3f get_gravity() const
Retrieves the current gravity setting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_valid() const
Returns true if the descriptor is valid.
void set_gravity(const LVector3f &gravity)
Sets a constant gravity for the entire scene.
PhysxController * create_controller(PhysxControllerDesc &controllerDesc)
Creates a new character controller.
void set_timing_fixed(float maxTimestep=1.0f/60.0f, unsigned int maxIter=8)
Sets simulation timing parameters used in simulate.
PhysxOverlapReport overlap_sphere_shapes(const LPoint3f ¢er, float radius, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), bool accurateCollision=true) const
Returns the set of shapes overlapped by the world-space sphere.
PhysxForceField * create_force_field(PhysxForceFieldDesc &desc)
Creates a force field in this scene.
PhysxDebugGeomNode * get_debug_geom_node()
Retrieves the debug geom node for this scene.
TypeHandle is the identifier used to differentiate C++ class types.
unsigned int get_hightest_material_index() const
Returns current highest valid material index.
void set_filter_ops(PhysxFilterOp op0, PhysxFilterOp op1, PhysxFilterOp op2)
Setups filtering operations.
PhysxFilterOp get_filter_op2() const
Retrieves the op2 filtering operation.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PhysxRaycastReport raycast_all_bounds(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns a PhysxRaycastReport object which can be used to iterate over all shapes that have been enclo...
Objects of this class are returned by the 'raycast all' methods.
Represents an ray as an origin and direction.
PhysxVehicle * create_vehicle(PhysxVehicleDesc &desc)
Creates a vehicle in this scene.
Renderable geometry which represents visualizations of physics objects.
Expresses the dominance relationship of a constraint.
bool get_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB)
Returns /true/ if contact generation between a pair of shapes is enabled, and /false/ if contact gene...
bool get_filter_bool() const
Retrieves filtering's boolean value.