Panda3D
physxDistanceJointDesc.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxDistanceJointDesc.cxx
10  * @author enn0x
11  * @date 2009-09-28
12  */
13 
14 #include "physxDistanceJointDesc.h"
15 #include "physxSpringDesc.h"
16 
17 /**
18  * Sets the maximum rest length of the rope or rod between the two anchor
19  * points.
20  */
22 set_max_distance(float distance) {
23 
24  _desc.maxDistance = distance;
25 }
26 
27 /**
28  * Sets the minimum rest length of the rope or rod between the two anchor
29  * points
30  */
32 set_min_distance(float distance) {
33 
34  _desc.minDistance = distance;
35 }
36 
37 /**
38  * Makes the joint springy. The spring.targetValue is not used.
39  */
41 set_spring(const PhysxSpringDesc &spring) {
42 
43  _desc.spring = spring._desc;
44 }
45 
46 /**
47  * Sets or clears a single DistanceJointFlag flag.
48  */
50 set_flag(PhysxDistanceJointFlag flag, bool value) {
51 
52  if (value == true) {
53  _desc.flags |= flag;
54  }
55  else {
56  _desc.flags &= ~(flag);
57  }
58 }
59 
60 /**
61  *
62  */
63 float PhysxDistanceJointDesc::
64 get_max_distance() const {
65 
66  return _desc.maxDistance;
67 }
68 
69 /**
70  *
71  */
72 float PhysxDistanceJointDesc::
73 get_min_distance() const {
74 
75  return _desc.minDistance;
76 }
77 
78 /**
79  *
80  */
81 PhysxSpringDesc PhysxDistanceJointDesc::
82 get_spring() const {
83 
84  PhysxSpringDesc value;
85  value._desc = _desc.spring;
86  return value;
87 }
88 
89 /**
90  * Return a single DistanceJointFlag flag.
91  */
93 get_flag(PhysxDistanceJointFlag flag) const {
94 
95  return (_desc.flags & flag) ? true : false;
96 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool get_flag(PhysxDistanceJointFlag flag) const
Return a single DistanceJointFlag flag.
Describes a joint spring.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_spring(const PhysxSpringDesc &spring)
Makes the joint springy.
void set_flag(PhysxDistanceJointFlag flag, bool value)
Sets or clears a single DistanceJointFlag flag.
void set_max_distance(float distance)
Sets the maximum rest length of the rope or rod between the two anchor points.
void set_min_distance(float distance)
Sets the minimum rest length of the rope or rod between the two anchor points.