Module KX_ObjectActuator
[hide private]
[frames] | no frames]

Source Code for Module KX_ObjectActuator

  1  # $Id: KX_ObjectActuator.py 16320 2008-08-31 19:07:10Z ben2610 $ 
  2  # Documentation for KX_ObjectActuator 
  3  from SCA_IActuator import * 
  4   
5 -class KX_ObjectActuator(SCA_IActuator):
6 """ 7 The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, 8 velocity, or angular velocity to an object. 9 Servo control allows to regulate force to achieve a certain speed target. 10 """
11 - def getForce():
12 """ 13 Returns the force applied by the actuator. 14 15 @rtype: list [fx, fy, fz, local] 16 @return: A four item list, containing the vector force, and a flag specifying whether the force is local. 17 """
18 - def setForce(fx, fy, fz, local):
19 """ 20 Sets the force applied by the actuator. 21 22 @type fx: float 23 @param fx: the x component of the force. 24 @type fy: float 25 @param fy: the z component of the force. 26 @type fz: float 27 @param fz: the z component of the force. 28 @type local: boolean 29 @param local: - False: the force is applied in world coordinates. 30 - True: the force is applied in local coordinates. 31 """
32 - def getTorque():
33 """ 34 Returns the torque applied by the actuator. 35 36 @rtype: list [S{Tau}x, S{Tau}y, S{Tau}z, local] 37 @return: A four item list, containing the vector torque, and a flag specifying whether 38 the torque is applied in local coordinates (True) or world coordinates (False) 39 """
40 - def setTorque(tx, ty, tz, local):
41 """ 42 Sets the torque applied by the actuator. 43 44 @type tx: float 45 @param tx: the x component of the torque. 46 @type ty: float 47 @param ty: the z component of the torque. 48 @type tz: float 49 @param tz: the z component of the torque. 50 @type local: boolean 51 @param local: - False: the torque is applied in world coordinates. 52 - True: the torque is applied in local coordinates. 53 """
54 - def getDLoc():
55 """ 56 Returns the displacement vector applied by the actuator. 57 58 @rtype: list [dx, dy, dz, local] 59 @return: A four item list, containing the vector displacement, and whether 60 the displacement is applied in local coordinates (True) or world 61 coordinates (False) 62 """
63 - def setDLoc(dx, dy, dz, local):
64 """ 65 Sets the displacement vector applied by the actuator. 66 67 Since the displacement is applied every frame, you must adjust the displacement 68 based on the frame rate, or you game experience will depend on the player's computer 69 speed. 70 71 @type dx: float 72 @param dx: the x component of the displacement vector. 73 @type dy: float 74 @param dy: the z component of the displacement vector. 75 @type dz: float 76 @param dz: the z component of the displacement vector. 77 @type local: boolean 78 @param local: - False: the displacement vector is applied in world coordinates. 79 - True: the displacement vector is applied in local coordinates. 80 """
81 - def getDRot():
82 """ 83 Returns the angular displacement vector applied by the actuator. 84 85 @rtype: list [dx, dy, dz, local] 86 @return: A four item list, containing the angular displacement vector, and whether 87 the displacement is applied in local coordinates (True) or world 88 coordinates (False) 89 """
90 - def setDRot(dx, dy, dz, local):
91 """ 92 Sets the angular displacement vector applied by the actuator. 93 94 Since the displacement is applied every frame, you must adjust the displacement 95 based on the frame rate, or you game experience will depend on the player's computer 96 speed. 97 98 @type dx: float 99 @param dx: the x component of the angular displacement vector. 100 @type dy: float 101 @param dy: the z component of the angular displacement vector. 102 @type dz: float 103 @param dz: the z component of the angular displacement vector. 104 @type local: boolean 105 @param local: - False: the angular displacement vector is applied in world coordinates. 106 - True: the angular displacement vector is applied in local coordinates. 107 """
108 - def getLinearVelocity():
109 """ 110 Returns the linear velocity applied by the actuator. 111 For the servo control actuator, this is the target speed. 112 113 @rtype: list [vx, vy, vz, local] 114 @return: A four item list, containing the vector velocity, and whether the velocity is applied in local coordinates (True) or world coordinates (False) 115 """
116 - def setLinearVelocity(vx, vy, vz, local):
117 """ 118 Sets the linear velocity applied by the actuator. 119 For the servo control actuator, sets the target speed. 120 121 @type vx: float 122 @param vx: the x component of the velocity vector. 123 @type vy: float 124 @param vy: the z component of the velocity vector. 125 @type vz: float 126 @param vz: the z component of the velocity vector. 127 @type local: boolean 128 @param local: - False: the velocity vector is in world coordinates. 129 - True: the velocity vector is in local coordinates. 130 """
131 - def getAngularVelocity():
132 """ 133 Returns the angular velocity applied by the actuator. 134 135 @rtype: list [S{omega}x, S{omega}y, S{omega}z, local] 136 @return: A four item list, containing the vector velocity, and whether 137 the velocity is applied in local coordinates (True) or world 138 coordinates (False) 139 """
140 - def setAngularVelocity(wx, wy, wz, local):
141 """ 142 Sets the angular velocity applied by the actuator. 143 144 @type wx: float 145 @param wx: the x component of the velocity vector. 146 @type wy: float 147 @param wy: the z component of the velocity vector. 148 @type wz: float 149 @param wz: the z component of the velocity vector. 150 @type local: boolean 151 @param local: - False: the velocity vector is applied in world coordinates. 152 - True: the velocity vector is applied in local coordinates. 153 """
154 - def getDamping():
155 """ 156 Returns the damping parameter of the servo controller. 157 158 @rtype: integer 159 @return: the time constant of the servo controller in frame unit. 160 """
161 - def setDamping(damp):
162 """ 163 Sets the damping parameter of the servo controller. 164 165 @type damp: integer 166 @param damp: the damping parameter in frame unit. 167 """
168 - def getForceLimitX():
169 """ 170 Returns the min/max force limit along the X axis used by the servo controller. 171 172 @rtype: list [min, max, enabled] 173 @return: A three item list, containing the min and max limits of the force as float 174 and whether the limits are active(true) or inactive(true) 175 """
176 - def setForceLimitX(min, max, enable):
177 """ 178 Sets the min/max force limit along the X axis and activates or deactivates the limits in the servo controller. 179 180 @type min: float 181 @param min: the minimum value of the force along the X axis. 182 @type max: float 183 @param max: the maximum value of the force along the X axis. 184 @type enable: boolean 185 @param enable: - True: the force will be limited to the min/max 186 - False: the force will not be limited 187 """
188 - def getForceLimitY():
189 """ 190 Returns the min/max force limit along the Y axis used by the servo controller. 191 192 @rtype: list [min, max, enabled] 193 @return: A three item list, containing the min and max limits of the force as float 194 and whether the limits are active(true) or inactive(true) 195 """
196 - def setForceLimitY(min, max, enable):
197 """ 198 Sets the min/max force limit along the Y axis and activates or deactivates the limits in the servo controller. 199 200 @type min: float 201 @param min: the minimum value of the force along the Y axis. 202 @type max: float 203 @param max: the maximum value of the force along the Y axis. 204 @type enable: boolean 205 @param enable: - True: the force will be limited to the min/max 206 - False: the force will not be limited 207 """
208 - def getForceLimitZ():
209 """ 210 Returns the min/max force limit along the Z axis used by the servo controller. 211 212 @rtype: list [min, max, enabled] 213 @return: A three item list, containing the min and max limits of the force as float 214 and whether the limits are active(true) or inactive(true) 215 """
216 - def setForceLimitZ(min, max, enable):
217 """ 218 Sets the min/max force limit along the Z axis and activates or deactivates the limits in the servo controller. 219 220 @type min: float 221 @param min: the minimum value of the force along the Z axis. 222 @type max: float 223 @param max: the maximum value of the force along the Z axis. 224 @type enable: boolean 225 @param enable: - True: the force will be limited to the min/max 226 - False: the force will not be limited 227 """
228 - def getPID():
229 """ 230 Returns the PID coefficient of the servo controller. 231 232 @rtype: list [P, I, D] 233 @return: A three item list, containing the PID coefficient as floats: 234 P : proportional coefficient 235 I : Integral coefficient 236 D : Derivate coefficient 237 """
238 - def setPID(P, I, D):
239 """ 240 Sets the PID coefficients of the servo controller. 241 242 @type P: flat 243 @param P: proportional coefficient 244 @type I: float 245 @param I: Integral coefficient 246 @type D: float 247 @param D: Derivate coefficient 248 """
249