Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bge.constraints.rst « rst « python_api « doc - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 018be96fd14c8b11e188a7ee0ad5deee5c13c92d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

Physics Constraints (bge.constraints)
=====================================

.. module:: bge.constraints

.. literalinclude:: ../examples/bge.constraints.py
   :language: rest
   :lines: 2-4

.. literalinclude:: ../examples/bge.constraints.py
   :lines: 6-

.. function:: createConstraint(physicsid, physicsid2, constrainttype, [pivotX, pivotY, pivotZ, [axisX, axisY, axisZ, [flag]]]])

   Creates a constraint.

   :arg physicsid: the physics id of the first object in constraint
   :type physicsid: int

   :arg physicsid2: the physics id of the second object in constraint
   :type physicsid2: int

   :arg constrainttype: the type of the constraint. The constraint types are:

   - :class:`POINTTOPOINT_CONSTRAINT`
   - :class:`LINEHINGE_CONSTRAINT`
   - :class:`ANGULAR_CONSTRAINT`
   - :class:`CONETWIST_CONSTRAINT`
   - :class:`VEHICLE_CONSTRAINT`
   - :class:`GENERIC_6DOF_CONSTRAINT`

   :type constrainttype: int

   :arg pivotX: pivot X position
   :type pivotX: float

   :arg pivotY: pivot Y position
   :type pivotY: float

   :arg pivotZ: pivot Z position
   :type pivotZ: float

   :arg axisX: X axis
   :type axisX: float

   :arg axisY: Y axis
   :type axisY: float

   :arg axisZ: Z axis
   :type axisZ: float

   :arg flag: 128 to disable collision between linked bodies
   :type flag: int

.. attribute:: error

   Simbolic constant string that indicates error.

.. function:: exportBulletFile(filename)

   export a .bullet file

   :arg filename: File name
   :type filename: string

.. function:: getAppliedImpulse(constraintId)

   :arg constraintId: The id of the constraint.
   :type constraintId: int

   :return: the most recent applied impulse.
   :rtype: float

.. function:: getVehicleConstraint(constraintId)

   :arg constraintId: The id of the vehicle constraint.
   :type constraintId: int

   :return: a vehicle constraint object.
   :rtype: :class:`bge.types.KX_VehicleWrapper`

.. function:: getCharacter(gameobj)

   :arg gameobj: The game object with the character physics.
   :type gameobj: :class:`bge.types.KX_GameObject`

   :return: character wrapper
   :rtype: :class:`bge.types.KX_CharacterWrapper`

.. function:: removeConstraint(constraintId)

   Removes a constraint.

   :arg constraintId: The id of the constraint to be removed.
   :type constraintId: int

.. function:: setCcdMode(ccdMode)

   .. note::
      Very experimental, not recommended

   Sets the CCD (Continous Colision Detection) mode in the Physics Environment.

   :arg ccdMode: The new CCD mode.
   :type ccdMode: int

.. function:: setContactBreakingTreshold(breakingTreshold)

   .. note::
      Reasonable default is 0.02 (if units are meters)

   Sets tresholds to do with contact point management.

   :arg breakingTreshold: The new contact breaking treshold.
   :type breakingTreshold: float

.. function:: setDeactivationAngularTreshold(angularTreshold)

   Sets the angular velocity treshold.

   :arg angularTreshold: New deactivation angular treshold.
   :type angularTreshold: float

.. function:: setDeactivationLinearTreshold(linearTreshold)

   Sets the linear velocity treshold.

   :arg linearTreshold: New deactivation linear treshold.
   :type linearTreshold: float

.. function:: setDeactivationTime(time)

   Sets the time after which a resting rigidbody gets deactived.

   :arg time: The deactivation time.
   :type time: float

.. function:: setDebugMode(mode)

   Sets the debug mode.

   Debug modes:
      - :class:`DBG_NODEBUG`
      - :class:`DBG_DRAWWIREFRAME`
      - :class:`DBG_DRAWAABB`
      - :class:`DBG_DRAWFREATURESTEXT`
      - :class:`DBG_DRAWCONTACTPOINTS`
      - :class:`DBG_NOHELPTEXT`
      - :class:`DBG_DRAWTEXT`
      - :class:`DBG_PROFILETIMINGS`
      - :class:`DBG_ENABLESATCOMPARISION`
      - :class:`DBG_DISABLEBULLETLCP`
      - :class:`DBG_ENABLECCD`
      - :class:`DBG_DRAWCONSTRAINTS`
      - :class:`DBG_DRAWCONSTRAINTLIMITS`
      - :class:`DBG_FASTWIREFRAME`

   :arg mode: The new debug mode.
   :type mode: int

.. function:: setGravity(x, y, z)

   Sets the gravity force.

   :arg x: Gravity X force.
   :type x: float

   :arg y: Gravity Y force.
   :type y: float

   :arg z: Gravity Z force.
   :type z: float

.. function:: setLinearAirDamping(damping)

   .. note::
      Not implemented.

   Sets the linear air damping for rigidbodies.

.. function:: setNumIterations(numiter)

   Sets the number of iterations for an iterative constraint solver.

   :arg numiter: New number of iterations.
   :type numiter: int

.. function:: setNumTimeSubSteps(numsubstep)

   Sets the number of substeps for each physics proceed. Tradeoff quality for performance.

   :arg numsubstep: New number of substeps.
   :type numsubstep: int

.. function:: setSolverDamping(damping)

   .. note::
      Very experimental, not recommended

   Sets the damper constant of a penalty based solver.

   :arg damping: New damping for the solver.
   :type damping: float

.. function:: setSolverTau(tau)

   .. note::
      Very experimental, not recommended

   Sets the spring constant of a penalty based solver.

   :arg tau: New tau for the solver.
   :type tau: float

.. function:: setSolverType(solverType)

   .. note::
      Very experimental, not recommended

   Sets the solver type.

   :arg solverType: The new type of the solver.
   :type solverType: int

.. function:: setSorConstant(sor)

   .. note::
      Very experimental, not recommended

   Sets the successive overrelaxation constant.

   :arg sor: New sor value.
   :type sor: float

.. function:: setUseEpa(epa)

   Not implemented.

.. data:: DBG_NODEBUG

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   No debug.

.. data:: DBG_DRAWWIREFRAME

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw wireframe in debug.

.. data:: DBG_DRAWAABB

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw Axis Aligned Bounding Box in debug.

.. data:: DBG_DRAWFREATURESTEXT

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw freatures text in debug.

.. data:: DBG_DRAWCONTACTPOINTS

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw contact points in debug.

.. data:: DBG_NOHELPTEXT

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Debug without help text.

.. data:: DBG_DRAWTEXT

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw text in debug.

.. data:: DBG_PROFILETIMINGS

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw profile timings in debug.

.. data:: DBG_ENABLESATCOMPARISION

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Enable sat comparision in debug.

.. data:: DBG_DISABLEBULLETLCP

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Disable Bullet LCP.

.. data:: DBG_ENABLECCD

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Enable Continous Colision Detection in debug.

.. data:: DBG_DRAWCONSTRAINTS

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw constraints in debug.

.. data:: DBG_DRAWCONSTRAINTLIMITS

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw constraint limits in debug.

.. data:: DBG_FASTWIREFRAME

   .. note::
      Debug mode to be used with function :class:`setDebugMode`

   Draw a fast wireframe in debug.

.. data:: POINTTOPOINT_CONSTRAINT

   .. note::
      Constraint type to be used with function :class:`createConstraint`

   .. to do

.. data:: LINEHINGE_CONSTRAINT

   .. note::
      Constraint type to be used with function :class:`createConstraint`

   .. to do

.. data:: ANGULAR_CONSTRAINT

   .. note::
      Constraint type to be used with function :class:`createConstraint`

   .. to do

.. data:: CONETWIST_CONSTRAINT

   .. note::
       Constraint type to be used with function :class:`createConstraint`

   .. to do

.. data:: VEHICLE_CONSTRAINT

   .. note::
      Constraint type to be used with function :class:`createConstraint`

   .. to do

.. data:: GENERIC_6DOF_CONSTRAINT

   .. note::
      Constraint type to be used with function :class:`createConstraint`

   .. to do