Panda3D
physxActor.cxx
1 // Filename: physxActor.cxx
2 // Created by: enn0x (14Sep09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "physxActor.h"
16 #include "physxActorDesc.h"
17 #include "physxBodyDesc.h"
18 #include "physxShapeDesc.h"
19 #include "physxManager.h"
20 
21 TypeHandle PhysxActor::_type_handle;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: PhysxActor::link
25 // Access: Public
26 // Description:
27 ////////////////////////////////////////////////////////////////////
28 void PhysxActor::
29 link(NxActor *actorPtr) {
30 
31  // Link self
32  _ptr = actorPtr;
33  _ptr->userData = this;
34  _error_type = ET_ok;
35 
36  set_name(actorPtr->getName());
37 
38  PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
39  scene->_actors.add(this);
40 
41  // Link shapes
42  NxShape * const *shapes = _ptr->getShapes();
43  NxU32 nShapes = _ptr->getNbShapes();
44 
45  for (NxU32 i=0; i < nShapes; i++) {
46  PhysxShape *shape = PhysxShape::factory(shapes[i]->getType());
47  shape->link(shapes[i]);
48  }
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: PhysxActor::unlink
53 // Access: Public
54 // Description:
55 ////////////////////////////////////////////////////////////////////
56 void PhysxActor::
57 unlink() {
58 
59  // Unlink shapes
60  NxShape * const *shapes = _ptr->getShapes();
61  NxU32 nShapes = _ptr->getNbShapes();
62 
63  for (NxU32 i=0; i < nShapes; i++) {
64  PhysxShape *shape = (PhysxShape *)shapes[i]->userData;
65  shape->unlink();
66  }
67 
68  // Unlink self
69  _ptr->userData = NULL;
70  _error_type = ET_released;
71 
72  PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
73  scene->_actors.remove(this);
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: PhysxActor::release
78 // Access: Published
79 // Description:
80 ////////////////////////////////////////////////////////////////////
81 void PhysxActor::
82 release() {
83 
84  nassertv(_error_type == ET_ok);
85 
86  unlink();
87  _ptr->getScene().releaseActor(*_ptr);
88  _ptr = NULL;
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: PhysxActor::link_controller
93 // Access: Public
94 // Description:
95 ////////////////////////////////////////////////////////////////////
96 void PhysxActor::
97 link_controller(PhysxController *controller) {
98 
99  _controller = controller;
100 }
101 
102 ////////////////////////////////////////////////////////////////////
103 // Function: PhysxActor::save_body_to_desc
104 // Access: Published
105 // Description: Saves the body information of a dynamic actor to
106 // the passed body descriptor.
107 ////////////////////////////////////////////////////////////////////
108 bool PhysxActor::
110 
111  nassertr(_error_type == ET_ok, false);
112  return _ptr->saveBodyToDesc(bodyDesc._desc);
113 }
114 
115 ////////////////////////////////////////////////////////////////////
116 // Function: PhysxActor::save_to_desc
117 // Access: Published
118 // Description: Saves the state of the actor to the passed
119 // descriptor.
120 ////////////////////////////////////////////////////////////////////
121 void PhysxActor::
122 save_to_desc(PhysxActorDesc &actorDesc) const {
123 
124  nassertv(_error_type == ET_ok);
125  _ptr->saveToDesc(actorDesc._desc);
126 }
127 
128 ////////////////////////////////////////////////////////////////////
129 // Function: PhysxActor::set_name
130 // Access: Published
131 // Description: Sets a name string for the object that can be
132 // retrieved with get_name().
133 // This is for debugging and is not used by the
134 // engine.
135 ////////////////////////////////////////////////////////////////////
136 void PhysxActor::
137 set_name(const char *name) {
138 
139  nassertv(_error_type == ET_ok);
140 
141  _name = name ? name : "";
142  _ptr->setName(_name.c_str());
143 }
144 
145 ////////////////////////////////////////////////////////////////////
146 // Function: PhysxActor::get_name
147 // Access: Published
148 // Description: Retrieves the name string.
149 ////////////////////////////////////////////////////////////////////
150 const char *PhysxActor::
151 get_name() const {
152 
153  nassertr(_error_type == ET_ok, "");
154  return _ptr->getName();
155 }
156 
157 ////////////////////////////////////////////////////////////////////
158 // Function: PhysxActor::update_transform
159 // Access: Public
160 // Description: Updates the transform of an assigned NodePath. If
161 // the actor has been created by a PhysxController
162 // then this method will update the NodePath's
163 // transform from the controller's transform.
164 ////////////////////////////////////////////////////////////////////
165 void PhysxActor::
167 
168  // Active transforms are update AFTER scene.fetchResults() has
169  // been called, and thus can contain removed objects. So either
170  // update transforms after scene.fetchResults() - which means
171  // poor performance - or check if an actor has been removed here
172  // in this method.
173  if (_error_type != ET_ok) return;
174 
175  if (_np.is_empty()) return;
176 
177  if (_controller) {
178  LVector3f hpr(_controller->get_h(), 0.0f, 0.0f);
179  LPoint3f pos = _controller->get_pos();
180  _np.set_transform(_np.get_top(), TransformState::make_pos_hpr(pos, hpr));
181  }
182  else {
183  _np.set_transform(_np.get_top(), TransformState::make_mat(m));
184  }
185 }
186 
187 ////////////////////////////////////////////////////////////////////
188 // Function: PhysxActor::get_global_pos
189 // Access: Published
190 // Description: Retrieves the actors world space position.
191 ////////////////////////////////////////////////////////////////////
193 get_global_pos() const {
194 
195  nassertr(_error_type == ET_ok, LPoint3f::zero());
196  return PhysxManager::nxVec3_to_point3(_ptr->getGlobalPosition());
197 }
198 
199 ////////////////////////////////////////////////////////////////////
200 // Function: PhysxActor::get_global_mat
201 // Access: Published
202 // Description: Retrieves the actors world space transform.
203 ////////////////////////////////////////////////////////////////////
205 get_global_mat() const {
206 
207  nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat());
208  return PhysxManager::nxMat34_to_mat4(_ptr->getGlobalPose());
209 }
210 
211 ////////////////////////////////////////////////////////////////////
212 // Function: PhysxActor::get_global_quat
213 // Access: Published
214 // Description: Retrieves the actors world space orientation.
215 ////////////////////////////////////////////////////////////////////
218 
219  nassertr(_error_type == ET_ok, LQuaternionf::zero());
220  return PhysxManager::nxQuat_to_quat(_ptr->getGlobalOrientation());
221 }
222 
223 ////////////////////////////////////////////////////////////////////
224 // Function: PhysxActor::set_global_pos
225 // Access: Published
226 // Description: Method for setting a dynamic actor's position in
227 // the world. Please see set_global_mat for some
228 // caveats.
229 ////////////////////////////////////////////////////////////////////
230 void PhysxActor::
232 
233  nassertv(_error_type == ET_ok);
234  nassertv_always(!pos.is_nan());
235 
236  _ptr->setGlobalPosition(PhysxManager::point3_to_nxVec3(pos));
237 }
238 
239 ////////////////////////////////////////////////////////////////////
240 // Function: PhysxActor::set_global_mat
241 // Access: Published
242 // Description: Method for setting a dynamic actor's transform
243 // matrix in the world.
244 //
245 // This method instantaneously changes the actor space
246 // to world space transformation.
247 //
248 // One should exercise restraint in making use of
249 // these methods.
250 //
251 // Static actors should not be moved at all. There are
252 // various internal data structures for static actors
253 // which may need to be recomputed when one moves.
254 // Also, moving static actors will not interact
255 // correctly with dynamic actors or joints. If you
256 // would like to directly control an actor's position
257 // and would like to have it correctly interact with
258 // dynamic bodies and joints, you should create a
259 // dynamic body with the BF_kinematic flag, and then
260 // use the move_global_*() commands to move it along
261 // a path!
262 //
263 // When briefly moving dynamic actors, one should not:
264 // - Move actors into other actors, thus causing
265 // interpenetration (an invalid physical state).
266 // - Move an actor that is connected by a joint to
267 // another away from the other (thus causing joint
268 // error).
269 // - When moving jointed actors the joints' cached
270 // transform information is destroyed and recreated
271 // next frame; thus this call is expensive for
272 // jointed actors.
273 ////////////////////////////////////////////////////////////////////
274 void PhysxActor::
276 
277  nassertv(_error_type == ET_ok);
278  nassertv_always(!mat.is_nan());
279 
280  _ptr->setGlobalPose(PhysxManager::mat4_to_nxMat34(mat));
281 }
282 
283 ////////////////////////////////////////////////////////////////////
284 // Function: PhysxActor::set_global_hpr
285 // Access: Published
286 // Description: Method for setting a dynamic actor's orientation in
287 // the world. Please see set_global_mat for some
288 // caveats.
289 ////////////////////////////////////////////////////////////////////
290 void PhysxActor::
291 set_global_hpr(float h, float p, float r) {
292 
293  nassertv(_error_type == ET_ok);
294 
295  LQuaternionf q;
296  q.set_hpr(LVector3f(h, p, r));
297  _ptr->setGlobalOrientationQuat(PhysxManager::quat_to_nxQuat(q));
298 }
299 
300 ////////////////////////////////////////////////////////////////////
301 // Function: PhysxActor::move_global_pos
302 // Access: Published
303 // Description: The move_global_* calls serve to move kinematically
304 // controlled dynamic actors through the game world.
305 //
306 // See move_global_mat() for more information.
307 //
308 // This call wakes the actor if it is sleeping.
309 ////////////////////////////////////////////////////////////////////
310 void PhysxActor::
312 
313  nassertv(_error_type == ET_ok);
314  nassertv_always(!pos.is_nan());
315 
316  _ptr->moveGlobalPosition(PhysxManager::point3_to_nxVec3(pos));
317 }
318 
319 ////////////////////////////////////////////////////////////////////
320 // Function: PhysxActor::move_global_mat
321 // Access: Published
322 // Description: The move_global_* calls serve to move
323 // kinematically controlled dynamic actors through
324 // the game world.
325 //
326 // You set a dynamic actor to be kinematic using the
327 // BF_KINEMATIC body flag, used either in the
328 // PhysBodyDesc or with set_body_flag().
329 //
330 // The move command will result in a velocity that,
331 // when successfully carried out (i.e. the motion is
332 // not blocked due to joints or collisions) inside
333 // run*(), will move the body into the desired pose.
334 // After the move is carried out during a single time
335 // step, the velocity is returned to zero. Thus, you
336 // must continuously call this in every time step for
337 // kinematic actors so that they move along a path.
338 //
339 // These functions simply store the move destination
340 // until run*() is called, so consecutive calls will
341 // simply overwrite the stored target variable.
342 //
343 // This call wakes the actor if it is sleeping.
344 ////////////////////////////////////////////////////////////////////
345 void PhysxActor::
347 
348  nassertv(_error_type == ET_ok);
349  nassertv_always(!mat.is_nan());
350 
351  _ptr->moveGlobalPose(PhysxManager::mat4_to_nxMat34(mat));
352 }
353 
354 ////////////////////////////////////////////////////////////////////
355 // Function: PhysxActor::move_global_hpr
356 // Access: Published
357 // Description: The move_global_* calls serve to move kinematically
358 // controlled dynamic actors through the game world.
359 //
360 // See move_global_mat() for more information.
361 //
362 // This call wakes the actor if it is sleeping.
363 ////////////////////////////////////////////////////////////////////
364 void PhysxActor::
365 move_global_hpr(float h, float p, float r) {
366 
367  nassertv(_error_type == ET_ok);
368 
369  LQuaternionf q;
370  q.set_hpr(LVector3f(h, p, r));
371  _ptr->moveGlobalOrientationQuat(PhysxManager::quat_to_nxQuat(q));
372 }
373 
374 ////////////////////////////////////////////////////////////////////
375 // Function: PhysxActor::attach_node_path
376 // Access: Published
377 // Description: Attaches a node path to this actor. The node
378 // path's transform will be updated automatically if
379 // the actor's transform changes (and only then).
380 //
381 // Note: any non-uniform scale or shear set on the
382 // NodePath's transform will be overwritten at the
383 // time of the first update.
384 ////////////////////////////////////////////////////////////////////
385 void PhysxActor::
387 
388  nassertv(_error_type == ET_ok);
389  nassertv_always(!np.is_empty());
390 
391  _np = NodePath(np);
392 }
393 
394 ////////////////////////////////////////////////////////////////////
395 // Function: PhysxActor::detach_node_path
396 // Access: Published
397 // Description: Detaches a previously assigned NodePath from this
398 // actor. The NodePath's transform will no longer
399 // be updated from the actor's transform.
400 ////////////////////////////////////////////////////////////////////
401 void PhysxActor::
403 
404  nassertv(_error_type == ET_ok);
405 
406  _np = NodePath();
407 }
408 
409 ////////////////////////////////////////////////////////////////////
410 // Function: PhysxActor::get_node_path
411 // Access: Published
412 // Description: Retrieves a previously attached NodePath. An empty
413 // NodePath will be returned if no NodePath has been
414 // attached to this actor.
415 ////////////////////////////////////////////////////////////////////
417 get_node_path() const {
418 
419  nassertr(_error_type == ET_ok, NodePath::fail());
420 
421  return _np;
422 }
423 
424 ////////////////////////////////////////////////////////////////////
425 // Function: PhysxActor::get_scene
426 // Access: Published
427 // Description: Retrieves the scene which this actor belongs to.
428 ////////////////////////////////////////////////////////////////////
430 get_scene() const {
431 
432  nassertr(_error_type == ET_ok, NULL);
433 
434  NxScene *scenePtr = &(_ptr->getScene());
435  PhysxScene *scene = (PhysxScene *)(scenePtr->userData);
436 
437  return scene;
438 }
439 
440 ////////////////////////////////////////////////////////////////////
441 // Function: PhysxActor::get_num_shapes
442 // Access: Published
443 // Description: Returns the number of shapes assigned to the
444 // actor.
445 ////////////////////////////////////////////////////////////////////
446 unsigned int PhysxActor::
447 get_num_shapes() const {
448 
449  nassertr(_error_type == ET_ok, -1);
450 
451  return _ptr->getNbShapes();
452 }
453 
454 ////////////////////////////////////////////////////////////////////
455 // Function: PhysxActor::create_shape
456 // Access: Published
457 // Description: Creates a new shape and adds it to the list of
458 // shapes of this actor.
459 //
460 // Mass properties of dynamic actors will not
461 // automatically be recomputed to reflect the new mass
462 // distribution implied by the shape. Follow this call
463 // with a call to update_mass_from_shapes() to do
464 // that.
465 ////////////////////////////////////////////////////////////////////
468 
469  nassertr(_error_type == ET_ok, NULL);
470  nassertr(desc.is_valid(),NULL);
471 
472  PhysxShape *shape = PhysxShape::factory(desc.ptr()->getType());
473  nassertr(shape, NULL);
474 
475  NxShape *shapePtr = _ptr->createShape(*desc.ptr());
476  nassertr(shapePtr, NULL);
477 
478  shape->link(shapePtr);
479 
480  return shape;
481 }
482 
483 ////////////////////////////////////////////////////////////////////
484 // Function: PhysxActor::get_shape
485 // Access: Published
486 // Description: Retrieves an individual shape from the actor's
487 // array of shapes. Index must be in the range from
488 // zero to (number-of-shapes minus 1).
489 ////////////////////////////////////////////////////////////////////
491 get_shape(unsigned int idx) const {
492 
493  nassertr(_error_type == ET_ok, NULL);
494  nassertr_always(idx < _ptr->getNbShapes(), NULL);
495 
496  NxShape * const *shapes = _ptr->getShapes();
497  NxShape *shapePtr = shapes[idx];
498  PhysxShape *shape = (PhysxShape *)(shapePtr->userData);
499 
500  return shape;
501 }
502 
503 ////////////////////////////////////////////////////////////////////
504 // Function: PhysxActor::get_shape_by_name
505 // Access: Published
506 // Description: Retrieves an individual shape from the actor's
507 // array of shapes. The first shape for which the
508 // shape's name matches the specified name is
509 // returned, or NULL if no shape has a matching name.
510 ////////////////////////////////////////////////////////////////////
512 get_shape_by_name(const char *name) const {
513 
514  nassertr(_error_type == ET_ok, NULL);
515 
516  NxShape * const *shapes = _ptr->getShapes();
517  NxShape *shapePtr = NULL;
518  NxU32 nShapes = _ptr->getNbShapes();
519 
520  for (NxU32 i=0; i < nShapes; i++) {
521  shapePtr = shapes[i];
522 
523  if (strcmp(shapePtr->getName(), name) == 0) {
524  return (PhysxShape *) shapePtr->userData;
525  }
526  }
527 
528  return NULL;
529 }
530 
531 ////////////////////////////////////////////////////////////////////
532 // Function: PhysxActor::add_force
533 // Access: Published
534 // Description: Applies a force (or impulse) defined in the global
535 // coordinate frame to the actor.
536 //
537 // This will not induce a torque.
538 //
539 // Mode determines if the torque is to be conventional
540 // or impulsive.
541 //
542 // The actor must be dynamic.
543 // This call wakes the actor if it is sleeping and the
544 // wakeup parameter is true (default).
545 ////////////////////////////////////////////////////////////////////
546 void PhysxActor::
547 add_force(const LVector3f force, PhysxForceMode mode, bool wakeup) {
548 
549  nassertv(_error_type == ET_ok);
550  nassertv_always(!force.is_nan());
551 
552  _ptr->addForce(PhysxManager::vec3_to_nxVec3(force), (NxForceMode)mode, wakeup);
553 }
554 
555 ////////////////////////////////////////////////////////////////////
556 // Function: PhysxActor::add_force_at_pos
557 // Access: Published
558 // Description: Applies a force (or impulse) defined in the global
559 // coordinate frame, acting at a particular point in
560 // global coordinates, to the actor.
561 //
562 // Note that if the force does not act along the
563 // center of mass of the actor, this will also add the
564 // corresponding torque. Because forces are reset at
565 // the end of every timestep, you can maintain a total
566 // external force on an object by calling this once
567 // every frame.
568 //
569 // Mode determines if the torque is to be conventional
570 // or impulsive.
571 //
572 // The actor must be dynamic.
573 // This call wakes the actor if it is sleeping and the
574 // wakeup parameter is true (default).
575 ////////////////////////////////////////////////////////////////////
576 void PhysxActor::
577 add_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) {
578 
579  nassertv(_error_type == ET_ok);
580  nassertv_always(!force.is_nan());
581  nassertv_always(!pos.is_nan());
582 
583  _ptr->addForceAtPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup);
584 }
585 
586 ////////////////////////////////////////////////////////////////////
587 // Function: PhysxActor::add_force_at_local_pos
588 // Access: Published
589 // Description: Applies a force (or impulse) defined in the global
590 // coordinate frame, acting at a particular point in
591 // local coordinates, to the actor.
592 //
593 // Note that if the force does not act along the
594 // center of mass of the actor, this will also add
595 // the corresponding torque. Because forces are reset
596 // at the end of every timestep, you can maintain a
597 // total external force on an object by calling this
598 // once every frame.
599 //
600 // Mode determines if the torque is to be conventional
601 // or impulsive.
602 //
603 // The actor must be dynamic.
604 // This call wakes the actor if it is sleeping and the
605 // wakeup parameter is true (default).
606 ////////////////////////////////////////////////////////////////////
607 void PhysxActor::
608 add_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) {
609 
610  nassertv(_error_type == ET_ok);
611  nassertv_always(!force.is_nan());
612  nassertv_always(!pos.is_nan());
613 
614  _ptr->addForceAtLocalPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup);
615 }
616 
617 ////////////////////////////////////////////////////////////////////
618 // Function: PhysxActor::add_torque
619 // Access: Published
620 // Description: Applies an impulsive torque defined in the global
621 // coordinate frame to the actor.
622 //
623 // Mode determines if the torque is to be conventional
624 // or impulsive.
625 //
626 // The actor must be dynamic.
627 // This call wakes the actor if it is sleeping and the
628 // wakeup parameter is true (default).
629 ////////////////////////////////////////////////////////////////////
630 void PhysxActor::
631 add_torque(const LVector3f torque, PhysxForceMode mode, bool wakeup) {
632 
633  nassertv(_error_type == ET_ok);
634  nassertv_always(!torque.is_nan());
635 
636  _ptr->addTorque(PhysxManager::vec3_to_nxVec3(torque), (NxForceMode)mode, wakeup);
637 }
638 
639 ////////////////////////////////////////////////////////////////////
640 // Function: PhysxActor::add_local_force
641 // Access: Published
642 // Description: Applies a force (or impulse) defined in the actor
643 // local coordinate frame to the actor.
644 // This will not induce a torque.
645 //
646 // Mode determines if the torque is to be conventional
647 // or impulsive.
648 //
649 // The actor must be dynamic.
650 // This call wakes the actor if it is sleeping and the
651 // wakeup parameter is true (default).
652 ////////////////////////////////////////////////////////////////////
653 void PhysxActor::
654 add_local_force(const LVector3f force, PhysxForceMode mode, bool wakeup) {
655 
656  nassertv(_error_type == ET_ok);
657  nassertv_always(!force.is_nan());
658 
659  _ptr->addLocalForce(PhysxManager::vec3_to_nxVec3(force), (NxForceMode)mode, wakeup);
660 }
661 
662 ////////////////////////////////////////////////////////////////////
663 // Function: PhysxActor::add_local_force_at_pos
664 // Access: Published
665 // Description: Applies a force (or impulse) defined in the actor
666 // local coordinate frame, acting at a particular
667 // point in global coordinates, to the actor.
668 //
669 // Note that if the force does not act along the
670 // center of mass of the actor, this will also add
671 // the corresponding torque. Because forces are reset
672 // at the end of every timestep, you can maintain a
673 // total external force on an object by calling this
674 // once every frame.
675 //
676 // Mode determines if the torque is to be conventional
677 // or impulsive.
678 //
679 // The actor must be dynamic.
680 // This call wakes the actor if it is sleeping and the
681 // wakeup parameter is true (default).
682 ////////////////////////////////////////////////////////////////////
683 void PhysxActor::
684 add_local_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) {
685 
686  nassertv(_error_type == ET_ok);
687  nassertv_always(!force.is_nan());
688  nassertv_always(!pos.is_nan());
689 
690  _ptr->addLocalForceAtPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup);
691 }
692 
693 ////////////////////////////////////////////////////////////////////
694 // Function: PhysxActor::add_local_force_at_local_pos
695 // Access: Published
696 // Description: Applies a force (or impulse) defined in the actor
697 // local coordinate frame, acting at a particular
698 // point in local coordinates, to the actor.
699 //
700 // Note that if the force does not act along the
701 // center of mass of the actor, this will also add the
702 // corresponding torque. Because forces are reset at
703 // the end of every timestep, you can maintain a total
704 // external force on an object by calling this once
705 // every frame.
706 //
707 // Mode determines if the torque is to be conventional
708 // or impulsive.
709 //
710 // The actor must be dynamic.
711 // This call wakes the actor if it is sleeping and the
712 // wakeup parameter is true (default).
713 ////////////////////////////////////////////////////////////////////
714 void PhysxActor::
715 add_local_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) {
716 
717  nassertv(_error_type == ET_ok);
718  nassertv_always(!force.is_nan());
719  nassertv_always(!pos.is_nan());
720 
721  _ptr->addLocalForceAtLocalPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup);
722 }
723 
724 ////////////////////////////////////////////////////////////////////
725 // Function: PhysxActor::add_local_torque
726 // Access: Published
727 // Description: Applies an impulsive torque defined in the actor
728 // local coordinate frame to the actor.
729 //
730 // Mode determines if the torque is to be conventional
731 // or impulsive.
732 //
733 // The actor must be dynamic.
734 // This call wakes the actor if it is sleeping and the
735 // wakeup parameter is true (default).
736 ////////////////////////////////////////////////////////////////////
737 void PhysxActor::
738 add_local_torque(const LVector3f torque, PhysxForceMode mode, bool wakeup) {
739 
740  nassertv(_error_type == ET_ok);
741  nassertv_always(!torque.is_nan());
742 
743  _ptr->addLocalTorque(PhysxManager::vec3_to_nxVec3(torque), (NxForceMode)mode, wakeup);
744 }
745 
746 ////////////////////////////////////////////////////////////////////
747 // Function: PhysxActor::update_mass_from_shapes
748 // Access: Published
749 // Description: Recomputes a dynamic actor's mass properties from
750 // its shapes.
751 //
752 // Given a constant density or total mass, the actors
753 // mass properties can be recomputed using the shapes
754 // attached to the actor. If the actor has no shapes,
755 // then only the totalMass parameter can be used. If
756 // all shapes in the actor are trigger shapes
757 // (non-physical), the call will fail.
758 //
759 // The mass of each shape is either the shape's local
760 // density (as specified in the PhysxShapeDesc;
761 // default 1.0) multiplied by the shape's volume or a
762 // directly specified shape mass.
763 //
764 // The inertia tensor, mass frame and center of mass
765 // will always be recomputed. If there are no shapes
766 // in the actor, the mass will be totalMass, and the
767 // mass frame will be set to the center of the actor.
768 //
769 // If you supply a non-zero total mass, the actor's
770 // mass and inertia will first be computed as above
771 // and then scaled to fit this total mass.
772 //
773 // If you supply a non-zero density, the actor's mass
774 // and inertia will first be computed as above and
775 // then scaled by this factor.
776 //
777 // Either totalMass or density must be non-zero.
778 //
779 // The actor must be dynamic.
780 ////////////////////////////////////////////////////////////////////
781 bool PhysxActor::
782 update_mass_from_shapes(float density, float totalMass) {
783 
784  nassertr(_error_type == ET_ok, false);
785  return _ptr->updateMassFromShapes(density, totalMass);
786 }
787 
788 ////////////////////////////////////////////////////////////////////
789 // Function: PhysxActor::compute_kinetic_energy
790 // Access: Published
791 // Description: Computes the total kinetic (rotational and
792 // translational) energy of the object.
793 // The actor must be dynamic.
794 ////////////////////////////////////////////////////////////////////
795 float PhysxActor::
797 
798  nassertr(_error_type == ET_ok, 0.0f);
799  return _ptr->computeKineticEnergy();
800 }
801 
802 ////////////////////////////////////////////////////////////////////
803 // Function: PhysxActor::is_dynamic
804 // Access: Published
805 // Description: Returns true if the actor is dynamic.
806 ////////////////////////////////////////////////////////////////////
807 bool PhysxActor::
808 is_dynamic() const {
809 
810  nassertr(_error_type == ET_ok, false);
811  return _ptr->isDynamic();
812 }
813 
814 ////////////////////////////////////////////////////////////////////
815 // Function: PhysxActor::set_shape_group
816 // Access: Published
817 // Description: Sets the collision group for all shapes of this
818 // actor. See PhysxShape.setGroup().
819 ////////////////////////////////////////////////////////////////////
820 void PhysxActor::
821 set_shape_group(unsigned int group) {
822 
823  nassertv(_error_type == ET_ok);
824  nassertv(group >= 0 && group < 32);
825 
826  NxShape * const *shapes = _ptr->getShapes();
827  NxU32 nShapes = _ptr->getNbShapes();
828 
829  for (NxU32 i=0; i < nShapes; i++) {
830  shapes[i]->setGroup( group );
831  }
832 }
833 
834 ////////////////////////////////////////////////////////////////////
835 // Function: PhysxActor::set_body_flag
836 // Access: Published
837 // Description: Raise or lower individual BodyFlag flags.
838 ////////////////////////////////////////////////////////////////////
839 void PhysxActor::
840 set_body_flag(PhysxBodyFlag flag, bool value) {
841 
842  if (value == true) {
843  _ptr->raiseBodyFlag((NxBodyFlag)flag);
844  }
845  else {
846  _ptr->clearBodyFlag((NxBodyFlag)flag);
847  }
848 }
849 
850 ////////////////////////////////////////////////////////////////////
851 // Function: PhysxActor::get_body_flag
852 // Access: Published
853 // Description: Return the specified BodyFlag flag.
854 ////////////////////////////////////////////////////////////////////
855 bool PhysxActor::
856 get_body_flag(PhysxBodyFlag flag) const {
857 
858  nassertr(_error_type == ET_ok, false);
859  return ptr()->readBodyFlag((NxBodyFlag)flag);
860 }
861 
862 ////////////////////////////////////////////////////////////////////
863 // Function: PhysxActor::set_actor_flag
864 // Access: Published
865 // Description: Raise or lower individual ActorFlag flags.
866 ////////////////////////////////////////////////////////////////////
867 void PhysxActor::
868 set_actor_flag(PhysxActorFlag flag, bool value) {
869 
870  if (value == true) {
871  _ptr->raiseActorFlag((NxActorFlag)flag);
872  }
873  else {
874  _ptr->clearActorFlag((NxActorFlag)flag);
875  }
876 }
877 
878 ////////////////////////////////////////////////////////////////////
879 // Function: PhysxActor::get_actor_flag
880 // Access: Published
881 // Description: Return the specified ActorFlag flag.
882 ////////////////////////////////////////////////////////////////////
883 bool PhysxActor::
884 get_actor_flag(PhysxActorFlag flag) const {
885 
886  nassertr(_error_type == ET_ok, false);
887  return ptr()->readActorFlag((NxActorFlag)flag);
888 }
889 
890 ////////////////////////////////////////////////////////////////////
891 // Function: PhysxActor::set_contact_report_flag
892 // Access: Published
893 // Description: Sets the actor's contact report flags.
894 //
895 // These flags are used to determine the kind of
896 // report that is generated for interactions with
897 // other actors.
898 //
899 // Please note: If the actor is part of an interacting
900 // pair for which the contact report generation is
901 // controlled already through any other mechanism
902 // (for example by use of
903 // PhysxScene::set_actor_pair_flags)
904 // then the union of all the specified contact report
905 // flags will be used to generate the report.
906 ////////////////////////////////////////////////////////////////////
907 void PhysxActor::
908 set_contact_report_flag(PhysxContactPairFlag flag, bool value) {
909 
910  nassertv(_error_type == ET_ok);
911 
912  NxU32 flags = _ptr->getContactReportFlags();
913 
914  if (value == true) {
915  flags |= flag;
916  }
917  else {
918  flags &= ~(flag);
919  }
920 
921  _ptr->setContactReportFlags(flags);
922 }
923 
924 ////////////////////////////////////////////////////////////////////
925 // Function: PhysxActor::set_contact_report_threshold
926 // Access: Published
927 // Description: Sets the force threshold for contact reports.
928 // The actor must be dynamic.
929 ////////////////////////////////////////////////////////////////////
930 void PhysxActor::
932 
933  nassertv(_error_type == ET_ok);
934  nassertv(threshold >= 0.0f);
935 
936  _ptr->setContactReportThreshold(threshold);
937 }
938 
939 ////////////////////////////////////////////////////////////////////
940 // Function: PhysxActor::set_group
941 // Access: Published
942 // Description: Assigns the actor to a user defined group of
943 // actors. The actor group must be an integer in
944 // between 0 and 0x7fff (32767).
945 //
946 // This is similar to NxShape groups, except those are
947 // only five bits and serve a different purpose.
948 //
949 // The PhysxScene::set_actor_group_pair_flags() lets
950 // you set certain behaviors for pairs of actor
951 // groups.
952 //
953 // By default every actor is created in group 0.
954 ////////////////////////////////////////////////////////////////////
955 void PhysxActor::
956 set_group(unsigned int group) {
957 
958  nassertv(_error_type == ET_ok);
959  nassertv(group >= 0 && group < 0x8000);
960 
961  ptr()->setGroup(group);
962 }
963 
964 ////////////////////////////////////////////////////////////////////
965 // Function: PhysxActor::get_group
966 // Access: Published
967 // Description: Retrieves the actor group this actor is assigned
968 // to.
969 ////////////////////////////////////////////////////////////////////
970 unsigned int PhysxActor::
971 get_group() const {
972 
973  nassertr(_error_type == ET_ok, 0);
974 
975  return ptr()->getGroup();
976 }
977 
978 ////////////////////////////////////////////////////////////////////
979 // Function: PhysxActor::set_dominance_group
980 // Access: Published
981 // Description: Assigns dynamic actors a dominance group
982 // identifier. Dominance groups are integere in the
983 // range from 0 to 31.
984 //
985 // This is similar to shape groups, except those serve
986 // a different purpose.
987 //
988 // The PhysxScene::set_dominance_group_pair() lets you
989 // set certain behaviors for pairs of dominance
990 // groups.
991 //
992 // By default every actor is created in group 0.
993 // Static actors must stay in group 0; thus you can
994 // only call this on dynamic actors.
995 ////////////////////////////////////////////////////////////////////
996 void PhysxActor::
997 set_dominance_group(unsigned int group) {
998 
999  nassertv(_error_type == ET_ok);
1000  nassertv(group >= 0 && group < 32);
1001  nassertv(is_dynamic() == true);
1002 
1003  _ptr->setDominanceGroup(group);
1004 }
1005 
1006 ////////////////////////////////////////////////////////////////////
1007 // Function: PhysxActor::get_dominance_group
1008 // Access: Published
1009 // Description: Retrieves the dominance group of this actor.
1010 ////////////////////////////////////////////////////////////////////
1011 unsigned int PhysxActor::
1013 
1014  nassertr(_error_type == ET_ok, 0);
1015 
1016  return ptr()->getDominanceGroup();
1017 }
1018 
1019 ////////////////////////////////////////////////////////////////////
1020 // Function: PhysxActor::set_angular_damping
1021 // Access: Published
1022 // Description: Sets the angular damping coefficient. Zero
1023 // represents no damping. The angular damping
1024 // coefficient must be nonnegative. The actor must be
1025 // dynamic.
1026 // Default: 0.05
1027 ////////////////////////////////////////////////////////////////////
1028 void PhysxActor::
1029 set_angular_damping(float angDamp) {
1030 
1031  nassertv(_error_type == ET_ok);
1032  nassertv(angDamp >= 0.0f);
1033 
1034  _ptr->setAngularDamping(angDamp);
1035 }
1036 
1037 ////////////////////////////////////////////////////////////////////
1038 // Function: PhysxActor::get_angular_damping
1039 // Access: Published
1040 // Description: Returns the angular damping coefficient.
1041 // The actor must be dynamic.
1042 ////////////////////////////////////////////////////////////////////
1043 float PhysxActor::
1045 
1046  nassertr(_error_type == ET_ok, 0.0f);
1047  return _ptr->getAngularDamping();
1048 }
1049 
1050 ////////////////////////////////////////////////////////////////////
1051 // Function: PhysxActor::set_linear_damping
1052 // Access: Published
1053 // Description: Sets the linear damping coefficient. Zero
1054 // represents no damping. The damping coefficient must
1055 // be nonnegative. The actor must be dynamic.
1056 // Default: 0
1057 ////////////////////////////////////////////////////////////////////
1058 void PhysxActor::
1059 set_linear_damping(float linDamp) {
1060 
1061  nassertv(_error_type == ET_ok);
1062  nassertv(linDamp >= 0.0f);
1063 
1064  _ptr->setLinearDamping(linDamp);
1065 }
1066 
1067 ////////////////////////////////////////////////////////////////////
1068 // Function: PhysxActor::get_linear_damping
1069 // Access: Published
1070 // Description: Retrieves the linear damping coefficient.
1071 // The actor must be dynamic.
1072 ////////////////////////////////////////////////////////////////////
1073 float PhysxActor::
1075 
1076  nassertr(_error_type == ET_ok, 0.0f);
1077  return _ptr->getLinearDamping();
1078 }
1079 
1080 ////////////////////////////////////////////////////////////////////
1081 // Function: PhysxActor::set_linear_velocity
1082 // Access: Published
1083 // Description: Sets the linear velocity of the actor.
1084 //
1085 // Note that if you continuously set the velocity of
1086 // an actor yourself, forces such as gravity or
1087 // friction will not be able to manifest themselves,
1088 // because forces directly influence only the
1089 // velocity/momentum of an actor.
1090 //
1091 // The actor must be dynamic.
1092 ////////////////////////////////////////////////////////////////////
1093 void PhysxActor::
1095 
1096  nassertv(_error_type == ET_ok);
1097  nassertv(_ptr->isDynamic());
1098 
1099  _ptr->setLinearVelocity(PhysxManager::vec3_to_nxVec3(linVel));
1100 }
1101 
1102 ////////////////////////////////////////////////////////////////////
1103 // Function: PhysxActor::set_angular_velocity
1104 // Access: Published
1105 // Description: Sets the angular velocity of the actor.
1106 //
1107 // Note that if you continuously set the angular
1108 // velocity of an actor yourself, forces such as
1109 // friction will not be able to rotate the actor,
1110 // because forces directly influence only the
1111 // velocity/momentum.
1112 //
1113 // The actor must be dynamic.
1114 ////////////////////////////////////////////////////////////////////
1115 void PhysxActor::
1117 
1118  nassertv(_error_type == ET_ok);
1119  nassertv(_ptr->isDynamic());
1120 
1121  _ptr->setAngularVelocity(PhysxManager::vec3_to_nxVec3(angVel));
1122 }
1123 
1124 ////////////////////////////////////////////////////////////////////
1125 // Function: PhysxActor::set_max_angular_velocity
1126 // Access: Published
1127 // Description: Lets you set the maximum angular velocity permitted
1128 // for this actor.
1129 //
1130 // Because for various internal computations, very
1131 // quickly rotating actors introduce error into the
1132 // simulation, which leads to undesired results.
1133 //
1134 // With PhysxManager::set_parameter(PP_max_angular_velocity)
1135 // you can set the default maximum velocity for actors
1136 // created after the call. Bodies' high angular
1137 // velocities are clamped to this value.
1138 //
1139 // However, because some actors, such as car wheels,
1140 // should be able to rotate quickly, you can override
1141 // the default setting on a per-actor basis with the
1142 // below call. Note that objects such as wheels which
1143 // are approximated with spherical or other smooth
1144 // collision primitives can be simulated with
1145 // stability at a much higher angular velocity than,
1146 // say, a box that has corners.
1147 //
1148 // The actor must be dynamic.
1149 ////////////////////////////////////////////////////////////////////
1150 void PhysxActor::
1151 set_max_angular_velocity(float maxAngVel) {
1152 
1153  nassertv(_error_type == ET_ok);
1154  nassertv(_ptr->isDynamic());
1155 
1156  _ptr->setMaxAngularVelocity(maxAngVel);
1157 }
1158 
1159 ////////////////////////////////////////////////////////////////////
1160 // Function: PhysxActor::get_linear_velocity
1161 // Access: Published
1162 // Description: Returns the linear velocity of an actor.
1163 // The actor must be dynamic.
1164 ////////////////////////////////////////////////////////////////////
1167 
1168  nassertr(_error_type == ET_ok, LVector3f::zero());
1169  return PhysxManager::nxVec3_to_vec3(_ptr->getLinearVelocity());
1170 }
1171 
1172 ////////////////////////////////////////////////////////////////////
1173 // Function: PhysxActor::get_angular_velocity
1174 // Access: Published
1175 // Description: Returns the angular velocity of the actor.
1176 // The actor must be dynamic.
1177 ////////////////////////////////////////////////////////////////////
1180 
1181  nassertr(_error_type == ET_ok, LVector3f::zero());
1182  return PhysxManager::nxVec3_to_vec3(_ptr->getAngularVelocity());
1183 }
1184 
1185 ////////////////////////////////////////////////////////////////////
1186 // Function: PhysxActor::get_max_angular_velocity
1187 // Access: Published
1188 // Description: Returns the maximum angular velocity permitted
1189 // for this actor.
1190 ////////////////////////////////////////////////////////////////////
1191 float PhysxActor::
1193 
1194  nassertr(_error_type == ET_ok, 0.0f);
1195  return _ptr->getMaxAngularVelocity();
1196 }
1197 
1198 ////////////////////////////////////////////////////////////////////
1199 // Function: PhysxActor::get_point_velocity
1200 // Access: Published
1201 // Description: Computes the velocity of a point given in world
1202 // coordinates if it were attached to the actor and
1203 // moving with it.
1204 //
1205 // The actor must be dynamic.
1206 ////////////////////////////////////////////////////////////////////
1208 get_point_velocity(const LPoint3f &point) const {
1209 
1210  nassertr(_error_type == ET_ok, LVector3f::zero());
1211  nassertr_always(!point.is_nan(), LVector3f::zero());
1212 
1213  NxVec3 nPoint = PhysxManager::point3_to_nxVec3(point);
1214  return PhysxManager::nxVec3_to_vec3(_ptr->getPointVelocity(nPoint));
1215 }
1216 
1217 ////////////////////////////////////////////////////////////////////
1218 // Function: PhysxActor::get_local_point_velocity
1219 // Access: Published
1220 // Description: Computes the velocity of a point given in body
1221 // local coordinates as if it were attached to the
1222 // actor and moving with it.
1223 //
1224 // The actor must be dynamic.
1225 ////////////////////////////////////////////////////////////////////
1227 get_local_point_velocity(const LPoint3f &point) const {
1228 
1229  nassertr(_error_type == ET_ok, LVector3f::zero());
1230  nassertr_always(!point.is_nan(), LVector3f::zero());
1231 
1232  NxVec3 nPoint = PhysxManager::point3_to_nxVec3(point);
1233  return PhysxManager::nxVec3_to_vec3(_ptr->getLocalPointVelocity(nPoint));
1234 }
1235 
1236 ////////////////////////////////////////////////////////////////////
1237 // Function: PhysxActor::set_linear_momentum
1238 // Access: Published
1239 // Description: Sets the linear momentum of the actor.
1240 // Note that if you continuously set the linear
1241 // momentum of an actor yourself, forces such as
1242 // gravity or friction will not be able to manifest
1243 // themselves, because forces directly influence only
1244 // the velocity/momentum of a actor.
1245 // The actor must be dynamic.
1246 ////////////////////////////////////////////////////////////////////
1247 void PhysxActor::
1248 set_linear_momentum(const LVector3f &momentum) {
1249 
1250  nassertv(_error_type == ET_ok);
1251  _ptr->setLinearMomentum(PhysxManager::vec3_to_nxVec3(momentum));
1252 }
1253 
1254 ////////////////////////////////////////////////////////////////////
1255 // Function: PhysxActor::set_angular_momentum
1256 // Access: Published
1257 // Description: Sets the angular momentum of the actor.
1258 // Note that if you continuously set the angular
1259 // velocity of an actor yourself, forces such as
1260 // friction will not be able to rotate the actor,
1261 // because forces directly influence only the velocity
1262 // of actor.
1263 // The actor must be dynamic.
1264 ////////////////////////////////////////////////////////////////////
1265 void PhysxActor::
1267 
1268  nassertv(_error_type == ET_ok);
1269  _ptr->setAngularMomentum(PhysxManager::vec3_to_nxVec3(momentum));
1270 }
1271 
1272 ////////////////////////////////////////////////////////////////////
1273 // Function: PhysxActor::get_linear_momentum
1274 // Access: Published
1275 // Description: Retrieves the linear momentum of an actor.
1276 // The momentum is equal to the velocity times the
1277 // mass.
1278 // The actor must be dynamic.
1279 ////////////////////////////////////////////////////////////////////
1282 
1283  nassertr(_error_type == ET_ok, LVector3f::zero());
1284  return PhysxManager::nxVec3_to_vec3(_ptr->getLinearMomentum());
1285 }
1286 
1287 ////////////////////////////////////////////////////////////////////
1288 // Function: PhysxActor::get_angular_momentum
1289 // Access: Published
1290 // Description: Retrieves the angular momentum of an actor.
1291 // The angular momentum is equal to the angular
1292 // velocity times the global space inertia tensor.
1293 // The actor must be dynamic.
1294 ////////////////////////////////////////////////////////////////////
1297 
1298  nassertr(_error_type == ET_ok, LVector3f::zero());
1299  return PhysxManager::nxVec3_to_vec3(_ptr->getAngularMomentum());
1300 }
1301 
1302 ////////////////////////////////////////////////////////////////////
1303 // Function: PhysxActor::set_sleep_linear_velocity
1304 // Access: Published
1305 // Description: Sets the linear velocity below which an actor may
1306 // go to sleep. Actors whose linear velocity is above
1307 // this threshold will not be put to sleep.
1308 //
1309 // Setting the sleep angular/linear velocity only
1310 // makes sense when the BF_energy_sleep_test is not
1311 // set.
1312 //
1313 // The actor must be dynamic.
1314 ////////////////////////////////////////////////////////////////////
1315 void PhysxActor::
1316 set_sleep_linear_velocity(float threshold) {
1317 
1318  nassertv(_error_type == ET_ok);
1319  _ptr->setSleepLinearVelocity(threshold);
1320 }
1321 
1322 ////////////////////////////////////////////////////////////////////
1323 // Function: PhysxActor::set_sleep_angular_velocity
1324 // Access: Published
1325 // Description: Sets the angular velocity below which an actor may
1326 // go to sleep. Actors whose angular velocity is
1327 // above this threshold will not be put to sleep.
1328 //
1329 // Setting the sleep angular/linear velocity only
1330 // makes sense when the BF_energy_sleep_test is not
1331 // set.
1332 //
1333 // The actor must be dynamic.
1334 ////////////////////////////////////////////////////////////////////
1335 void PhysxActor::
1336 set_sleep_angular_velocity(float threshold) {
1337 
1338  nassertv(_error_type == ET_ok);
1339  _ptr->setSleepAngularVelocity(threshold);
1340 }
1341 
1342 ////////////////////////////////////////////////////////////////////
1343 // Function: PhysxActor::set_sleep_energy_threshold
1344 // Access: Published
1345 // Description: Sets the energy threshold below which an actor may
1346 // go to sleep. Actors whose kinematic energy is above
1347 // this threshold will not be put to sleep.
1348 //
1349 // Setting the sleep energy threshold only makes sense
1350 // when the BF_energy_sleep_test is set. There are
1351 // also other types of sleeping that uses the linear
1352 // and angular velocities directly instead of the
1353 // energy.
1354 //
1355 // The actor must be dynamic.
1356 ////////////////////////////////////////////////////////////////////
1357 void PhysxActor::
1358 set_sleep_energy_threshold(float threshold) {
1359 
1360  nassertv(_error_type == ET_ok);
1361  _ptr->setSleepEnergyThreshold(threshold);
1362 }
1363 
1364 ////////////////////////////////////////////////////////////////////
1365 // Function: PhysxActor::get_sleep_linear_velocity
1366 // Access: Published
1367 // Description: Returns the linear velocity below which an actor
1368 // may go to sleep. Actors whose linear velocity is
1369 // above this threshold will not be put to sleep.
1370 // The actor must be dynamic.
1371 ////////////////////////////////////////////////////////////////////
1372 float PhysxActor::
1374 
1375  nassertr(_error_type == ET_ok, 0.0f);
1376  return _ptr->getSleepLinearVelocity();
1377 }
1378 
1379 ////////////////////////////////////////////////////////////////////
1380 // Function: PhysxActor::get_sleep_angular_velocity
1381 // Access: Published
1382 // Description: Returns the angular velocity below which an actor
1383 // may go to sleep. Actors whose angular velocity is
1384 // above this threshold will not be put to sleep.
1385 // The actor must be dynamic.
1386 ////////////////////////////////////////////////////////////////////
1387 float PhysxActor::
1389 
1390  nassertr(_error_type == ET_ok, 0.0f);
1391  return _ptr->getSleepAngularVelocity();
1392 }
1393 
1394 ////////////////////////////////////////////////////////////////////
1395 // Function: PhysxActor::get_sleep_energy_threshold
1396 // Access: Published
1397 // Description: Returns the energy below which an actor may go to
1398 // sleep. Actors whose energy is above this threshold
1399 // will not be put to sleep. The actor must be dynamic.
1400 ////////////////////////////////////////////////////////////////////
1401 float PhysxActor::
1403 
1404  nassertr(_error_type == ET_ok, 0.0f);
1405  return _ptr->getSleepEnergyThreshold();
1406 }
1407 
1408 ////////////////////////////////////////////////////////////////////
1409 // Function: PhysxActor::is_sleeping
1410 // Access: Published
1411 // Description: Returns true if this body is sleeping.
1412 //
1413 // When an actor does not move for a period of time,
1414 // it is no longer simulated in order to save time.
1415 // This state is called sleeping. However, because the
1416 // object automatically wakes up when it is either
1417 // touched by an awake object, or one of its
1418 // properties is changed by the user, the entire sleep
1419 // mechanism should be transparent to the user.
1420 //
1421 // The actor must be dynamic.
1422 ////////////////////////////////////////////////////////////////////
1423 bool PhysxActor::
1424 is_sleeping() const {
1425 
1426  nassertr(_error_type == ET_ok, false);
1427  return _ptr->isSleeping();
1428 }
1429 
1430 ////////////////////////////////////////////////////////////////////
1431 // Function: PhysxActor::wake_up
1432 // Access: Published
1433 // Description: Wakes up the actor if it is sleeping.
1434 //
1435 // The wakeCounterValue determines how long until the
1436 // body is put to sleep, a value of zero means that
1437 // the body is sleeping. wake_up(0) is equivalent to
1438 // PhysxActor::put_to_sleep().
1439 //
1440 // The actor must be dynamic.
1441 ////////////////////////////////////////////////////////////////////
1442 void PhysxActor::
1443 wake_up(float wakeCounterValue) {
1444 
1445  nassertv(_error_type == ET_ok);
1446  _ptr->wakeUp(wakeCounterValue);
1447 }
1448 
1449 ////////////////////////////////////////////////////////////////////
1450 // Function: PhysxActor::put_to_sleep
1451 // Access: Published
1452 // Description: Forces the actor to sleep.
1453 //
1454 // The actor will stay asleep until the next call to
1455 // simulate, and will not wake up until then even when
1456 // otherwise it would (for example a force is applied
1457 // to it). It can however wake up during the next
1458 // do_physics call.
1459 //
1460 // The actor must be dynamic.
1461 ////////////////////////////////////////////////////////////////////
1462 void PhysxActor::
1464 
1465  nassertv(_error_type == ET_ok);
1466  _ptr->putToSleep();
1467 }
1468 
1469 ////////////////////////////////////////////////////////////////////
1470 // Function: PhysxActor::set_mass
1471 // Access: Published
1472 // Description: Sets the mass of a dynamic actor.
1473 ////////////////////////////////////////////////////////////////////
1474 void PhysxActor::
1475 set_mass(float mass) {
1476 
1477  nassertv(_error_type == ET_ok);
1478  _ptr->setMass(mass);
1479 }
1480 
1481 ////////////////////////////////////////////////////////////////////
1482 // Function: PhysxActor::get_mass
1483 // Access: Published
1484 // Description: Returns the mass of the actor.
1485 ////////////////////////////////////////////////////////////////////
1486 float PhysxActor::
1487 get_mass() const {
1488 
1489  nassertr(_error_type == ET_ok, 0.0f);
1490  return _ptr->getMass();
1491 }
1492 
1493 ////////////////////////////////////////////////////////////////////
1494 // Function: PhysxActor::set_c_mass_offset_local_mat
1495 // Access: Published
1496 // Description: Sets the matrix of the center of mass relative
1497 // to the actor.
1498 ////////////////////////////////////////////////////////////////////
1499 void PhysxActor::
1501 
1502  nassertv(_error_type == ET_ok);
1503  _ptr->setCMassOffsetLocalPose(PhysxManager::mat4_to_nxMat34(mat));
1504 }
1505 
1506 ////////////////////////////////////////////////////////////////////
1507 // Function: PhysxActor::set_c_mass_offset_local_pos
1508 // Access: Published
1509 // Description: Sets the position of the center of mass relative
1510 // to the actor.
1511 ////////////////////////////////////////////////////////////////////
1512 void PhysxActor::
1514 
1515  nassertv(_error_type == ET_ok);
1516  _ptr->setCMassOffsetLocalPosition(PhysxManager::point3_to_nxVec3(pos));
1517 }
1518 
1519 ////////////////////////////////////////////////////////////////////
1520 // Function: PhysxActor::set_c_mass_offset_local_orientation
1521 // Access: Published
1522 // Description: Sets the orientation of the center of mass relative
1523 // to the actor.
1524 ////////////////////////////////////////////////////////////////////
1525 void PhysxActor::
1527 
1528  nassertv(_error_type == ET_ok);
1529  _ptr->setCMassOffsetLocalOrientation(PhysxManager::mat3_to_nxMat33(mat));
1530 }
1531 
1532 ////////////////////////////////////////////////////////////////////
1533 // Function: PhysxActor::set_c_mass_offset_global_mat
1534 // Access: Published
1535 // Description: Sets the matrix of the center of mass relative
1536 // to world space.
1537 ////////////////////////////////////////////////////////////////////
1538 void PhysxActor::
1540 
1541  nassertv(_error_type == ET_ok);
1542  _ptr->setCMassOffsetGlobalPose(PhysxManager::mat4_to_nxMat34(mat));
1543 }
1544 
1545 ////////////////////////////////////////////////////////////////////
1546 // Function: PhysxActor::set_c_mass_offset_global_pos
1547 // Access: Published
1548 // Description: Sets the position of the center of mass relative
1549 // to world space.
1550 ////////////////////////////////////////////////////////////////////
1551 void PhysxActor::
1553 
1554  nassertv(_error_type == ET_ok);
1555  _ptr->setCMassOffsetGlobalPosition(PhysxManager::point3_to_nxVec3(pos));
1556 }
1557 
1558 ////////////////////////////////////////////////////////////////////
1559 // Function: PhysxActor::set_c_mass_offset_global_orientation
1560 // Access: Published
1561 // Description: Sets the orientation of the center of mass relative
1562 // to world space.
1563 ////////////////////////////////////////////////////////////////////
1564 void PhysxActor::
1566 
1567  nassertv(_error_type == ET_ok);
1568  _ptr->setCMassOffsetGlobalOrientation(PhysxManager::mat3_to_nxMat33(mat));
1569 }
1570 
1571 ////////////////////////////////////////////////////////////////////
1572 // Function: PhysxActor::set_c_mass_global_mat
1573 // Access: Published
1574 // Description: Moves the actor by setting the transform of the
1575 // center of mass.
1576 ////////////////////////////////////////////////////////////////////
1577 void PhysxActor::
1579 
1580  nassertv(_error_type == ET_ok);
1581  _ptr->setCMassGlobalPose(PhysxManager::mat4_to_nxMat34(mat));
1582 }
1583 
1584 ////////////////////////////////////////////////////////////////////
1585 // Function: PhysxActor::set_c_mass_global_pos
1586 // Access: Published
1587 // Description: Moves the actor by setting the position of the
1588 // center of mass.
1589 ////////////////////////////////////////////////////////////////////
1590 void PhysxActor::
1592 
1593  nassertv(_error_type == ET_ok);
1594  _ptr->setCMassGlobalPosition(PhysxManager::point3_to_nxVec3(pos));
1595 }
1596 
1597 ////////////////////////////////////////////////////////////////////
1598 // Function: PhysxActor::set_c_mass_global_orientation
1599 // Access: Published
1600 // Description: Moves the actor by setting the orientation of the
1601 // center of mass.
1602 ////////////////////////////////////////////////////////////////////
1603 void PhysxActor::
1605 
1606  nassertv(_error_type == ET_ok);
1607  _ptr->setCMassGlobalOrientation(PhysxManager::mat3_to_nxMat33(mat));
1608 }
1609 
1610 ////////////////////////////////////////////////////////////////////
1611 // Function: PhysxActor::set_mass_space_inertia_tensor
1612 // Access: Published
1613 // Description: Sets the inertia tensor, using a parameter
1614 // specified in mass space coordinates.
1615 ////////////////////////////////////////////////////////////////////
1616 void PhysxActor::
1618 
1619  nassertv(_error_type == ET_ok);
1620  _ptr->setMassSpaceInertiaTensor(PhysxManager::vec3_to_nxVec3(m));
1621 }
1622 
1623 ////////////////////////////////////////////////////////////////////
1624 // Function: PhysxActor::get_c_mass_global_mat
1625 // Access: Published
1626 // Description: Returns the center of mass transform in world
1627 // space.
1628 ////////////////////////////////////////////////////////////////////
1631 
1632  nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat());
1633  return PhysxManager::nxMat34_to_mat4(_ptr->getCMassGlobalPose());
1634 }
1635 
1636 ////////////////////////////////////////////////////////////////////
1637 // Function: PhysxActor::get_c_mass_global_pos
1638 // Access: Published
1639 // Description: Returns the center of mass position in world
1640 // space.
1641 ////////////////////////////////////////////////////////////////////
1644 
1645  nassertr(_error_type == ET_ok, LPoint3f::zero());
1646  return PhysxManager::nxVec3_to_point3(_ptr->getCMassGlobalPosition());
1647 }
1648 
1649 ////////////////////////////////////////////////////////////////////
1650 // Function: PhysxActor::get_c_mass_global_orientation
1651 // Access: Published
1652 // Description: Returns the center of mass orientation in world
1653 // space.
1654 ////////////////////////////////////////////////////////////////////
1657 
1658  nassertr(_error_type == ET_ok, LMatrix3f::ident_mat());
1659  return PhysxManager::nxMat33_to_mat3(_ptr->getCMassGlobalOrientation());
1660 }
1661 
1662 ////////////////////////////////////////////////////////////////////
1663 // Function: PhysxActor::get_c_mass_local_mat
1664 // Access: Published
1665 // Description: Returns the center of mass transform relative
1666 // to the actor.
1667 ////////////////////////////////////////////////////////////////////
1670 
1671  nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat());
1672  return PhysxManager::nxMat34_to_mat4(_ptr->getCMassLocalPose());
1673 }
1674 
1675 ////////////////////////////////////////////////////////////////////
1676 // Function: PhysxActor::get_c_mass_local_pos
1677 // Access: Published
1678 // Description: Returns the center of mass position relative to
1679 // the actor.
1680 ////////////////////////////////////////////////////////////////////
1683 
1684  nassertr(_error_type == ET_ok, LPoint3f::zero());
1685  return PhysxManager::nxVec3_to_point3(_ptr->getCMassLocalPosition());
1686 }
1687 
1688 ////////////////////////////////////////////////////////////////////
1689 // Function: PhysxActor::get_c_mass_local_orientation
1690 // Access: Published
1691 // Description: Returns the center of mass orientation relative to
1692 // the actor.
1693 ////////////////////////////////////////////////////////////////////
1696 
1697  nassertr(_error_type == ET_ok, LMatrix3f::ident_mat());
1698  return PhysxManager::nxMat33_to_mat3(_ptr->getCMassLocalOrientation());
1699 }
1700 
1701 ////////////////////////////////////////////////////////////////////
1702 // Function: PhysxActor::get_mass_space_inertia_tensor
1703 // Access: Published
1704 // Description: Returns the diagonal inertia tensor of the actor
1705 // relative to the mass coordinate frame.
1706 ////////////////////////////////////////////////////////////////////
1709 
1710  nassertr(_error_type == ET_ok, LVector3f::zero());
1711  return PhysxManager::nxVec3_to_vec3(_ptr->getMassSpaceInertiaTensor());
1712 }
1713 
1714 ////////////////////////////////////////////////////////////////////
1715 // Function: PhysxActor::get_global_inertia_tensor
1716 // Access: Published
1717 // Description: Returns the inertia tensor of the actor relative
1718 // to the world coordinate frame.
1719 ////////////////////////////////////////////////////////////////////
1722 
1723  nassertr(_error_type == ET_ok, LMatrix3f::ident_mat());
1724  return PhysxManager::nxMat33_to_mat3(_ptr->getGlobalInertiaTensor());
1725 }
1726 
1727 ////////////////////////////////////////////////////////////////////
1728 // Function: PhysxActor::get_global_inertia_tensor_inverse
1729 // Access: Published
1730 // Description: Returns the inverse of the inertia tensor of the
1731 // actor relative to the world coordinate frame.
1732 ////////////////////////////////////////////////////////////////////
1735 
1736  nassertr(_error_type == ET_ok, LMatrix3f::ident_mat());
1737  return PhysxManager::nxMat33_to_mat3(_ptr->getGlobalInertiaTensorInverse());
1738 }
1739 
LVector3f get_angular_velocity() const
Returns the angular velocity of the actor.
LPoint3f get_c_mass_local_pos() const
Returns the center of mass position relative to the actor.
float get_sleep_energy_threshold() const
Returns the energy below which an actor may go to sleep.
void set_sleep_linear_velocity(float threshold)
Sets the linear velocity below which an actor may go to sleep.
unsigned int get_dominance_group() const
Retrieves the dominance group of this actor.
bool save_body_to_desc(PhysxBodyDesc &bodyDesc) const
Saves the body information of a dynamic actor to the passed body descriptor.
Definition: physxActor.cxx:109
float get_sleep_linear_velocity() const
Returns the linear velocity below which an actor may go to sleep.
bool get_actor_flag(PhysxActorFlag flag) const
Return the specified ActorFlag flag.
Definition: physxActor.cxx:884
void add_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in ...
Definition: physxActor.cxx:608
static const LMatrix3f & ident_mat()
Returns an identity matrix.
Definition: lmatrix.h:2863
void set_contact_report_flag(PhysxContactPairFlag flag, bool value)
Sets the actor&#39;s contact report flags.
Definition: physxActor.cxx:908
void move_global_mat(const LMatrix4f &mat)
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world...
Definition: physxActor.cxx:346
void set_c_mass_offset_global_orientation(const LMatrix3f &mat)
Sets the orientation of the center of mass relative to world space.
bool is_empty() const
Returns true if the NodePath contains no nodes.
Definition: nodePath.I:236
void set_c_mass_offset_local_orientation(const LMatrix3f &mat)
Sets the orientation of the center of mass relative to the actor.
void move_global_hpr(float h, float p, float r)
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world...
Definition: physxActor.cxx:365
void set_linear_velocity(const LVector3f &linVel)
Sets the linear velocity of the actor.
static NxQuat quat_to_nxQuat(const LQuaternionf &q)
Converts from LQuaternionf to NxQuat.
Definition: physxManager.I:121
void set_body_flag(PhysxBodyFlag flag, bool value)
Raise or lower individual BodyFlag flags.
Definition: physxActor.cxx:840
LMatrix4f get_global_mat() const
Retrieves the actors world space transform.
Definition: physxActor.cxx:205
void set_mass(float mass)
Sets the mass of a dynamic actor.
void set_c_mass_offset_local_pos(const LPoint3f &pos)
Sets the position of the center of mass relative to the actor.
static const LPoint3f & zero()
Returns a zero-length point.
Definition: lpoint3.h:259
LVector3f get_linear_momentum() const
Retrieves the linear momentum of an actor.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
Definition: physxManager.I:77
Abstract base class for shapes.
Definition: physxShape.h:41
void set_c_mass_global_orientation(const LMatrix3f &mat)
Moves the actor by setting the orientation of the center of mass.
void set_linear_damping(float linDamp)
Sets the linear damping coefficient.
static const LVector3f & zero()
Returns a zero-length vector.
Definition: lvector3.h:270
bool is_sleeping() const
Returns true if this body is sleeping.
LVector3f get_point_velocity(const LPoint3f &point) const
Computes the velocity of a point given in world coordinates if it were attached to the actor and movi...
void set_global_pos(const LPoint3f &pos)
Method for setting a dynamic actor&#39;s position in the world.
Definition: physxActor.cxx:231
void set_shape_group(unsigned int group)
Sets the collision group for all shapes of this actor.
Definition: physxActor.cxx:821
float compute_kinetic_energy() const
Computes the total kinetic (rotational and translational) energy of the object.
Definition: physxActor.cxx:796
LVector3f get_mass_space_inertia_tensor() const
Returns the diagonal inertia tensor of the actor relative to the mass coordinate frame.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
float get_sleep_angular_velocity() const
Returns the angular velocity below which an actor may go to sleep.
float get_mass() const
Returns the mass of the actor.
void set_actor_flag(PhysxActorFlag flag, bool value)
Raise or lower individual ActorFlag flags.
Definition: physxActor.cxx:868
void set_mass_space_inertia_tensor(const LVector3f &m)
Sets the inertia tensor, using a parameter specified in mass space coordinates.
LMatrix3f get_c_mass_local_orientation() const
Returns the center of mass orientation relative to the actor.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A scene is a collection of bodies, constraints, and effectors which can interact. ...
Definition: physxScene.h:73
LPoint3f get_global_pos() const
Retrieves the actors world space position.
Definition: physxActor.cxx:193
void add_local_torque(const LVector3f torque, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies an impulsive torque defined in the actor local coordinate frame to the actor.
Definition: physxActor.cxx:738
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase3.h:464
void update_transform(const LMatrix4f &m)
Updates the transform of an assigned NodePath.
Definition: physxActor.cxx:166
void set_linear_momentum(const LVector3f &momentum)
Sets the linear momentum of the actor.
bool is_nan() const
Returns true if any component of the matrix is not-a-number, false otherwise.
Definition: lmatrix.h:1417
float get_max_angular_velocity() const
Returns the maximum angular velocity permitted for this actor.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
Definition: physxManager.I:145
LMatrix3f get_global_inertia_tensor() const
Returns the inertia tensor of the actor relative to the world coordinate frame.
LQuaternionf get_global_quat() const
Retrieves the actors world space orientation.
Definition: physxActor.cxx:217
void set_transform(const TransformState *transform, Thread *current_thread=Thread::get_current_thread())
Changes the complete transform object on this node.
Definition: nodePath.I:718
const char * get_name() const
Retrieves the name string.
Definition: physxActor.cxx:151
void add_local_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular poin...
Definition: physxActor.cxx:684
unsigned int get_num_shapes() const
Returns the number of shapes assigned to the actor.
Definition: physxActor.cxx:447
LMatrix4f get_c_mass_global_mat() const
Returns the center of mass transform in world space.
void move_global_pos(const LPoint3f &pos)
The move_global_* calls serve to move kinematically controlled dynamic actors through the game world...
Definition: physxActor.cxx:311
void save_to_desc(PhysxActorDesc &actorDesc) const
Saves the state of the actor to the passed descriptor.
Definition: physxActor.cxx:122
void add_force(const LVector3f force, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies a force (or impulse) defined in the global coordinate frame to the actor. ...
Definition: physxActor.cxx:547
void set_sleep_angular_velocity(float threshold)
Sets the angular velocity below which an actor may go to sleep.
void set_global_hpr(float h, float p, float r)
Method for setting a dynamic actor&#39;s orientation in the world.
Definition: physxActor.cxx:291
void add_local_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular poin...
Definition: physxActor.cxx:715
void wake_up(float wakeCounterValue=NX_SLEEP_INTERVAL)
Wakes up the actor if it is sleeping.
Abstract base class for character controllers.
static NodePath fail()
Creates a NodePath with the ET_fail error type set.
Definition: nodePath.I:185
void set_angular_momentum(const LVector3f &momentum)
Sets the angular momentum of the actor.
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
PhysxShape * get_shape(unsigned int idx) const
Retrieves an individual shape from the actor&#39;s array of shapes.
Definition: physxActor.cxx:491
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
Definition: physxManager.I:33
static LQuaternionf nxQuat_to_quat(const NxQuat &q)
Converts from NxQuat to LQuaternionf.
Definition: physxManager.I:134
static NxMat33 mat3_to_nxMat33(const LMatrix3f &m)
Converts from LMatrix3f to NxMat33.
Definition: physxManager.I:169
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Definition: physxManager.I:44
void set_contact_report_threshold(float threshold)
Sets the force threshold for contact reports.
Definition: physxActor.cxx:931
bool update_mass_from_shapes(float density, float totalMass)
Recomputes a dynamic actor&#39;s mass properties from its shapes.
Definition: physxActor.cxx:782
Descriptor for PhysxActor.
LVector3f get_linear_velocity() const
Returns the linear velocity of an actor.
PhysxShape * create_shape(PhysxShapeDesc &desc)
Creates a new shape and adds it to the list of shapes of this actor.
Definition: physxActor.cxx:467
void add_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in ...
Definition: physxActor.cxx:577
bool is_dynamic() const
Returns true if the actor is dynamic.
Definition: physxActor.cxx:808
void set_hpr(const LVecBase3f &hpr, CoordinateSystem cs=CS_default)
Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
float get_linear_damping() const
Retrieves the linear damping coefficient.
void set_sleep_energy_threshold(float threshold)
Sets the energy threshold below which an actor may go to sleep.
void add_local_force(const LVector3f force, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies a force (or impulse) defined in the actor local coordinate frame to the actor.
Definition: physxActor.cxx:654
LMatrix3f get_c_mass_global_orientation() const
Returns the center of mass orientation in world space.
void set_angular_velocity(const LVector3f &angVel)
Sets the angular velocity of the actor.
void set_c_mass_global_mat(const LMatrix4f &mat)
Moves the actor by setting the transform of the center of mass.
static const LMatrix4f & zeros_mat()
Returns an matrix filled with zeros.
Definition: lmatrix.h:923
void set_name(const char *name)
Sets a name string for the object that can be retrieved with get_name().
Definition: physxActor.cxx:137
void set_global_mat(const LMatrix4f &mat)
Method for setting a dynamic actor&#39;s transform matrix in the world.
Definition: physxActor.cxx:275
void set_c_mass_offset_global_pos(const LPoint3f &pos)
Sets the position of the center of mass relative to world space.
Abstract base class for shape descriptors.
LPoint3f get_c_mass_global_pos() const
Returns the center of mass position in world space.
LMatrix3f get_global_inertia_tensor_inverse() const
Returns the inverse of the inertia tensor of the actor relative to the world coordinate frame...
void set_max_angular_velocity(float maxAngVel)
Lets you set the maximum angular velocity permitted for this actor.
This is the base quaternion class.
Definition: lquaternion.h:96
void attach_node_path(const NodePath &np)
Attaches a node path to this actor.
Definition: physxActor.cxx:386
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
Definition: physxManager.I:88
void add_torque(const LVector3f torque, PhysxForceMode mode=FM_force, bool wakeup=true)
Applies an impulsive torque defined in the global coordinate frame to the actor.
Definition: physxActor.cxx:631
void detach_node_path()
Detaches a previously assigned NodePath from this actor.
Definition: physxActor.cxx:402
unsigned int get_group() const
Retrieves the actor group this actor is assigned to.
Definition: physxActor.cxx:971
void set_c_mass_offset_global_mat(const LMatrix4f &mat)
Sets the matrix of the center of mass relative to world space.
NodePath get_top(Thread *current_thread=Thread::get_current_thread()) const
Returns a singleton NodePath that represents the top of the path, or empty NodePath if this path is e...
Definition: nodePath.cxx:317
Descriptor for the optional rigid body dynamic state of PhysxActor.
Definition: physxBodyDesc.h:29
PhysxShape * get_shape_by_name(const char *name) const
Retrieves an individual shape from the actor&#39;s array of shapes.
Definition: physxActor.cxx:512
bool get_body_flag(PhysxBodyFlag flag) const
Return the specified BodyFlag flag.
Definition: physxActor.cxx:856
PhysxScene * get_scene() const
Retrieves the scene which this actor belongs to.
Definition: physxActor.cxx:430
LVector3f get_local_point_velocity(const LPoint3f &point) const
Computes the velocity of a point given in body local coordinates as if it were attached to the actor ...
void put_to_sleep()
Forces the actor to sleep.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This is a 3-by-3 transform matrix.
Definition: lmatrix.h:110
void set_group(unsigned int group)
Assigns the actor to a user defined group of actors.
Definition: physxActor.cxx:956
void set_c_mass_global_pos(const LPoint3f &pos)
Moves the actor by setting the position of the center of mass.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
Definition: physxManager.I:158
NodePath get_node_path() const
Retrieves a previously attached NodePath.
Definition: physxActor.cxx:417
static LMatrix3f nxMat33_to_mat3(const NxMat33 &m)
Converts from NxMat33 to LMatrix3f.
Definition: physxManager.I:182
LVector3f get_angular_momentum() const
Retrieves the angular momentum of an actor.
void set_c_mass_offset_local_mat(const LMatrix4f &mat)
Sets the matrix of the center of mass relative to the actor.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
void set_dominance_group(unsigned int group)
Assigns dynamic actors a dominance group identifier.
Definition: physxActor.cxx:997
LMatrix4f get_c_mass_local_mat() const
Returns the center of mass transform relative to the actor.
static const LVecBase4f & zero()
Returns a zero-length vector.
Definition: lvecBase4.h:493
float get_angular_damping() const
Returns the angular damping coefficient.
void set_angular_damping(float angDamp)
Sets the angular damping coefficient.