forked from kripken/ammo.js
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Ammo.d.ts
1455 lines (1330 loc) · 45.3 KB
/
Ammo.d.ts
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// tslint:disable
declare function Ammo(): Promise<void>;
declare namespace Ammo {
type Constructor<T = {}> = new (...args: any[]) => T;
type VoidPtr = number;
type Pointer = { ptr: number };
const NULL: {};
const PHY_FLOAT: number;
const HEAPF32: Float32Array;
function destroy(obj: Ammo.Type): void;
function castObject<T1, T2 extends Ammo.Type>(obj: T1, fun: Constructor<T2>): T2;
function wrapPointer<T extends Ammo.Type>(params: number, obj: Constructor<T>): T;
function addFunction(params: Function): number;
function getClass(obj: Ammo.Type): void;
function getPointer(obj: Ammo.Type): number;
function getCache(fun: Constructor<Ammo.Type>): void;
function _malloc(byte: number): number;
function _free(...args: any): any;
function compare(obj1: Ammo.Type, obj2: Ammo.Type): boolean;
interface btIDebugDraw {
drawLine(from: btVector3, to: btVector3, color: btVector3): void;
drawContactPoint(
pointOnB: btVector3,
normalOnB: btVector3,
distance: number,
lifeTime: number,
color: btVector3,
): void;
reportErrorWarning(warningString: string): void;
draw3dText(location: btVector3, textString: string): void;
setDebugMode(debugMode: number): void;
getDebugMode(): number;
}
class DebugDrawer implements btIDebugDraw {
constructor();
public drawLine(from: btVector3, to: btVector3, color: btVector3): void;
public drawContactPoint(
pointOnB: btVector3,
normalOnB: btVector3,
distance: number,
lifeTime: number,
color: btVector3,
): void;
public reportErrorWarning(warningString: string): void;
public draw3dText(location: btVector3, textString: string): void;
public setDebugMode(debugMode: number): void;
public getDebugMode(): number;
}
class btVector3 {
constructor();
constructor(x: number, y: number, z: number);
public length(): number;
public x(): number;
public y(): number;
public z(): number;
public setX(x: number): void;
public setY(y: number): void;
public setZ(z: number): void;
public setValue(x: number, y: number, z: number): void;
public normalize(): void;
/**[Value] */
public rotate(wAxis: btVector3, angle: number): btVector3;
public dot(v: btVector3): number;
public op_mul(x: number): btVector3;
public op_add(v: btVector3): btVector3;
public op_sub(v: btVector3): btVector3;
}
class btVector4 extends btVector3 {
constructor();
constructor(x: number, y: number, z: number, w: number);
public w(): number;
public setValue(x: number, y: number, z: number): void;
public setValue(x: number, y: number, z: number, w: number): void;
}
class btQuadWord {
public x(): number;
public y(): number;
public z(): number;
public w(): number;
public setX(x: number): void;
public setY(y: number): void;
public setZ(z: number): void;
public setW(w: number): void;
}
class btQuaternion extends btQuadWord {
constructor();
constructor(x: number, y: number, z: number, w: number);
public setValue(x: number, y: number, z: number, w: number): void;
public setEulerZYX(z: number, y: number, x: number): void;
public setRotation(axis: btVector3, angle: number): void;
public normalize(): void;
public length2(): number;
public length(): number;
public dot(q: btQuaternion): number;
/**[Value] */
public normalized(): btQuaternion;
/**[Value] */
public getAxis(): btVector3;
/**[Value] */
public inverse(): btQuaternion;
public getAngle(): number;
public getAngleShortestPath(): number;
public angle(q: btQuaternion): number;
public angleShortestPath(q: btQuaternion): number;
public op_add(q: btQuaternion): btQuaternion;
public op_sub(q: btQuaternion): btQuaternion;
public op_mul(s: number): btQuaternion;
public op_mulq(q: btQuaternion): btQuaternion;
public op_div(s: number): btQuaternion;
}
class btMatrix3x3 {
public setEulerZYX(ex: number, ey: number, ez: number): void;
public getRotation(q: btQuaternion): void;
public getRow(y: number): btVector3;
}
class btTransform {
constructor();
constructor(q: btQuaternion, v: btVector3);
public setIdentity(): void;
public setOrigin(origin: btVector3): void;
public setRotation(rotation: btQuaternion): void;
public getOrigin(): btVector3;
/**[Value] */
public getRotation(): btQuaternion;
public getBasis(): btMatrix3x3;
public setFromOpenGLMatrix(m: number[]): void;
/**[Value] */
public inverse(): btTransform;
public op_mul(t: btTransform): btTransform;
}
class btMotionState {
public getWorldTransform(worldTrans: btTransform): void;
public setWorldTransform(worldTrans: btTransform): void;
}
class btDefaultMotionState extends btMotionState {
public m_graphicsWorldTrans: btTransform;
constructor(startTrans?: btTransform, centerOfMassOffset?: btTransform);
}
class btCollisionObject {
public setAnisotropicFriction(
anisotropicFriction: btVector3,
frictionMode: number,
): void;
public getCollisionShape(): btCollisionShape;
public setContactProcessingThreshold(contactProcessingThreshold: number): void;
public getActivationState(): number;
public setActivationState(newState: number): void;
public forceActivationState(newState: number): void;
public activate(forceActivation?: boolean): void;
public isActive(): boolean;
public isKinematicObject(): boolean;
public isStaticObject(): boolean;
public isStaticOrKinematicObject(): boolean;
public setRestitution(rest: number): void;
public setFriction(frict: number): void;
public setRollingFriction(frict: number): void;
public setSpinningFriction(frict: number): void;
public getWorldTransform(): btTransform;
public getCollisionFlags(): number;
public setCollisionFlags(flags: number): void;
public setWorldTransform(worldTrans: btTransform): void;
public setCollisionShape(collisionShape: btCollisionShape): void;
public setCcdMotionThreshold(ccdMotionThreshold: number): void;
public setCcdSweptSphereRadius(radius: number): void;
public getUserIndex(): number;
public setUserIndex(index: number): void;
public setUserIndex2(index: number): void;
public getUserPointer(): Pointer;
public setUserPointer(userPointer: VoidPtr): void;
public getBroadphaseHandle(): btBroadphaseProxy;
public checkCollideWith(co: btCollisionObject): boolean;
public setIgnoreCollisionCheck(co: btCollisionObject, ig: boolean): void;
public setInterpolationWorldTransform(trans: btTransform): void;
public getInterpolationWorldTransform(): btTransform;
}
class btCollisionObjectWrapper { }
class RayResultCallback {
public m_collisionFilterGroup: number;
public m_collisionFilterMask: number;
public m_closestHitFraction: number;
public m_collisionObject: btCollisionObject;
public hasHit(): boolean;
public get_m_collisionObject(): btCollisionObject;
}
class ClosestRayResultCallback extends RayResultCallback {
public m_rayFromWorld: btVector3;
public m_rayToWorld: btVector3;
public m_hitNormalWorld: btVector3;
public m_hitPointWorld: btVector3;
constructor(from: btVector3, to: btVector3);
public get_m_hitPointWorld(): btVector3;
public get_m_hitNormalWorld(): btVector3;
}
class ccClosestRayResultCallback extends ClosestRayResultCallback {
constructor(from: btVector3, to: btVector3);
getHitNormalWorld(): btVector3;
getHitPointWorld(): btVector3;
getCollisionShapePtr(): number;
getClosestHitFraction(): number;
reset(m: number, qt: boolean): void;
}
interface btArray<T> {
clear(): void;
size(): number;
at(n: number): T;
}
interface btNumberArray extends btArray<number> { }
interface btConstCollisionObjectArray extends btArray<btCollisionObject> { }
interface btVector3Array extends btArray<btVector3> { }
class AllHitsRayResultCallback extends RayResultCallback {
public m_rayFromWorld: btVector3;
public m_rayToWorld: btVector3;
public m_hitNormalWorld: btVector3Array;
public m_hitPointWorld: btVector3Array;
constructor(from: btVector3, to: btVector3);
public get_m_hitPointWorld(): btVector3Array;
public get_m_hitNormalWorld(): btVector3Array;
public m_hitFractions: btNumberArray;
public m_collisionObjects: btConstCollisionObjectArray;
}
class ccAllHitsRayResultCallback extends AllHitsRayResultCallback {
constructor(from: btVector3, to: btVector3);
public reset(m: number, qt: boolean): void;
public getHitFractions(): btNumberArray;
public getHitNormalWorld(): btVector3Array;
public getHitPointWorld(): btVector3Array;
public getCollisionShapePtrs(): btNumberArray;
}
class btManifoldPoint {
public m_localPointA: btVector3;
public m_localPointB: btVector3;
public m_positionWorldOnB: btVector3;
public m_positionWorldOnA: btVector3;
public m_normalWorldOnB: btVector3;
public getPositionWorldOnA(): btVector3;
public getPositionWorldOnB(): btVector3;
public getAppliedImpulse(): number;
public getDistance(): number;
public get_m_positionWorldOnB(): btVector3;
public get_m_normalWorldOnB(): btVector3;
public m_distance1: number;
public m_combinedFriction: number;
public m_combinedRollingFriction: number;
public m_combinedRestitution: number;
//BP mod, store contact triangles.
public m_partId0: number;
public m_partId1: number;
public m_index0: number;
public m_index1: number;
// Contact callback support
public m_userPersistentData: any;
public m_userPersistentData0: any;
public m_userPersistentData1: any;
public getShape0(): btCollisionShape;
public getShape1(): btCollisionShape;
}
class ContactResultCallback {
public addSingleResult(
cp: btManifoldPoint,
colObj0Wrap: btCollisionObjectWrapper,
partId0: number,
index0: number,
colObj1Wrap: btCollisionObjectWrapper,
partId1: number,
index1: number,
): number;
}
class ConcreteContactResultCallback extends ContactResultCallback { }
class LocalShapeInfo {
public m_shapePart: number;
public m_triangleIndex: number;
}
class LocalConvexResult {
public m_hitCollisionObject: btCollisionObject;
public m_localShapeInfo: LocalShapeInfo;
public m_hitNormalLocal: btVector3;
public m_hitPointLocal: btVector3;
public m_hitFraction: number;
constructor(
hitCollisionObject: btCollisionObject,
localShapeInfo: LocalShapeInfo,
hitNormalLocal: btVector3,
hitPointLocal: btVector3,
hitFraction: number,
);
}
class ConvexResultCallback {
public m_collisionFilterGroup: number;
public m_collisionFilterMask: number;
public m_closestHitFraction: number;
public hasHit(): boolean;
}
class ClosestConvexResultCallback extends ConvexResultCallback {
public m_convexFromWorld: btVector3;
public m_convexToWorld: btVector3;
public m_hitNormalWorld: btVector3;
public m_hitPointWorld: btVector3;
constructor(convexFromWorld: btVector3, convexToWorld: btVector3);
}
class btCollisionShape {
public setLocalScaling(scaling: btVector3): void;
public getLocalScaling(): btVector3;
public calculateLocalInertia(mass: number, inertia: btVector3): void;
public setMargin(margin: number): void;
public getMargin(): number;
public getUserIndex(): number;
public setUserIndex(i: number): void;
public getUserPointerAsInt(): number;
public setUserPointerAsInt(i: number): void;
public isCompound(): boolean;
public getAabb(t: btTransform, min: btVector3, max: btVector3): void;
///XXX
public getLocalBoundingSphere(): number;
}
class btConvexShape extends btCollisionShape { }
class btEmptyShape extends btCollisionShape { }
class btConvexTriangleMeshShape extends btConvexShape {
constructor(meshInterface: btStridingMeshInterface, calcAabb?: boolean);
}
class btBU_Simplex1to4 extends btConvexShape {
constructor();
addVertex(pt: btVector3): void;
}
class btBoxShape extends btCollisionShape {
constructor(boxHalfExtents: btVector3);
public setMargin(margin: number): void;
public getMargin(): number;
public setUnscaledHalfExtents(boxHalfExtents: btVector3): void;
}
class btCapsuleShape extends btCollisionShape {
constructor(radius: number, height: number);
public setMargin(margin: number): void;
public getMargin(): number;
public getUpAxis(): number;
public getRadius(): number;
public getHalfHeight(): number;
public getImplicitShapeDimensions(): btVector3;
//XXX
public updateProp(r: number, h: number, d: number): void;
}
class btCapsuleShapeX extends btCapsuleShape {
constructor(radius: number, height: number);
public setMargin(margin: number): void;
public getMargin(): number;
}
class btCapsuleShapeZ extends btCapsuleShape {
constructor(radius: number, height: number);
public setMargin(margin: number): void;
public getMargin(): number;
}
class btCylinderShape extends btCollisionShape {
constructor(halfExtents: btVector3);
public setMargin(margin: number): void;
public getMargin(): number;
public getImplicitShapeDimensions(): btVector3;
//XXX
public updateProp(r: number, h: number, d: number): void;
}
class btCylinderShapeX extends btCylinderShape {
constructor(halfExtents: btVector3);
public setMargin(margin: number): void;
public getMargin(): number;
}
class btCylinderShapeZ extends btCylinderShape {
constructor(halfExtents: btVector3);
public setMargin(margin: number): void;
public getMargin(): number;
}
class btSphereShape extends btCollisionShape {
constructor(radius: number);
public setMargin(margin: number): void;
public getMargin(): number;
public setUnscaledRadius(radius: number): void;
}
class btConeShape extends btCollisionShape {
constructor(radius: number, height: number);
public setConeUpIndex(i: number): void;
public setHeight(h: number): void;
public setRadius(r: number): void;
}
class btConvexHullShape extends btCollisionShape {
constructor(points?: number[], numPoints?: number);
public addPoint(point: btVector3, recalculateLocalAABB?: boolean): void;
public setMargin(margin: number): void;
public getMargin(): number;
public getNumVertices(): number;
public initializePolyhedralFeatures(shiftVerticesByMargin: number): boolean;
}
class btShapeHull {
constructor(shape: btConvexShape);
public buildHull(margin: number): boolean;
public numVertices(): number;
public getVertexPointer(): btVector3;
}
class btConeShapeX extends btConeShape {
constructor(radius: number, height: number);
}
class btConeShapeZ extends btConeShape {
constructor(radius: number, height: number);
}
class btCompoundShape extends btCollisionShape {
constructor(enableDynamicAabbTree?: boolean);
public addChildShape(localTransform: btTransform, shape: btCollisionShape): void;
public removeChildShape(shape: btCollisionShape): void;
public removeChildShapeByIndex(childShapeindex: number): void;
public getNumChildShapes(): number;
public getChildShape(index: number): btCollisionShape;
public setMargin(margin: number): void;
public getMargin(): number;
public updateChildTransform(childIndex: number, newChildTransform: btTransform, shouldRecalculateLocalAabb?: boolean): void;
public setMaterial(childShapeindex: number, f: number, r: number, rf?: number, sf?: number, m?: number): void;
}
class btStridingMeshInterface { }
class btTriangleMesh extends btStridingMeshInterface {
constructor(use32bitIndices?: boolean, use4componentVertices?: boolean);
public addTriangle(
vertex0: btVector3,
vertex1: btVector3,
vertex2: btVector3,
removeDuplicateVertices?: boolean,
): void;
}
enum PHY_ScalarType {
PHY_FLOAT,
PHY_DOUBLE,
PHY_INTEGER,
PHY_SHORT,
PHY_FIXEDPOINT88,
PHY_UCHAR,
}
class btConcaveShape extends btCollisionShape { }
class btStaticPlaneShape extends btConcaveShape {
constructor(planeNormal: btVector3, planeConstant: number);
// [Const, Ref] btVector3 getPlaneNormal();
getPlaneNormal(): btVector3;
// void setPlaneConstant(float v);
setPlaneConstant(v: number): void;
}
class btTriangleMeshShape extends btConcaveShape { }
class btBvhTriangleMeshShape extends btTriangleMeshShape {
constructor(
meshInterface: btStridingMeshInterface,
useQuantizedAabbCompression: boolean,
buildBvh?: boolean,
);
}
class btHeightfieldTerrainShape extends btConcaveShape {
constructor(
heightStickWidth: number,
heightStickLength: number,
heightfieldData: VoidPtr,
heightScale: number,
minHeight: number,
maxHeight: number,
upAxis: number,
hdt: string | number,
flipQuadEdges: boolean,
);
public setMargin(margin: number): void;
public getMargin(): number;
}
class btDefaultCollisionConstructionInfo {
// m_persistentManifoldPool: btPoolAllocator;
// m_collisionAlgorithmPool: btPoolAllocator;
m_defaultMaxPersistentManifoldPoolSize: number | 1;
m_defaultMaxCollisionAlgorithmPoolSize: number | 1;
m_customCollisionAlgorithmMaxElementSize: number | 1;
m_useEpaPenetrationAlgorithm: number | 1;
constructor();
}
class btDefaultCollisionConfiguration {
constructor(info?: btDefaultCollisionConstructionInfo);
}
class btPersistentManifold {
constructor();
public getBody0(): btCollisionObject;
public getBody1(): btCollisionObject;
public getNumContacts(): number;
public getContactPoint(index: number): btManifoldPoint;
}
class btDispatcher {
public getNumManifolds(): number;
public getManifoldByIndexInternal(index: number): btPersistentManifold;
}
class btCollisionDispatcher extends btDispatcher {
constructor(conf: btDefaultCollisionConfiguration);
public setDispatcherFlags(flags: number): void;
}
class btOverlappingPairCallback { }
interface btOverlapFilterCallback { }
class ccOverlapFilterCallback implements btOverlapFilterCallback { }
class btOverlappingPairCache {
public setInternalGhostPairCallback(x: btOverlappingPairCallback): void;
getNumOverlappingPairs(): number;
public setOverlapFilterCallback(x: btOverlapFilterCallback): void;
}
class btAxisSweep3 {
constructor(
worldAabbMin: btVector3,
worldAabbMax: btVector3,
maxHandles?: number,
pairCache?: btOverlappingPairCache,
disableRaycastAccelerator?: boolean,
);
}
class btBroadphaseInterface {
getOverlappingPairCache(): btOverlappingPairCache;
}
class btCollisionConfiguration { }
class btDbvtBroadphase extends btBroadphaseInterface {
constructor();
}
interface btBroadphaseProxy {
m_collisionFilterGroup: number;
m_collisionFilterMask: number;
}
class btRigidBodyConstructionInfo {
public m_linearDamping: number;
public m_angularDamping: number;
public m_friction: number;
public m_rollingFriction: number;
public m_restitution: number;
public m_linearSleepingThreshold: number;
public m_angularSleepingThreshold: number;
public m_additionalDamping: boolean;
public m_additionalDampingFactor: number;
public m_additionalLinearDampingThresholdSqr: number;
public m_additionalAngularDampingThresholdSqr: number;
public m_additionalAngularDampingFactor: number;
constructor(
mass: number,
motionState: btMotionState,
collisionShape: btCollisionShape,
localInertia?: btVector3,
);
}
class btRigidBody extends btCollisionObject {
constructor(constructionInfo: btRigidBodyConstructionInfo);
public getCenterOfMassTransform(): btTransform;
public setCenterOfMassTransform(xform: btTransform): void;
public setSleepingThresholds(linear: number, angular: number): void;
public getLinearSleepingThreshold(): number;
public getLinearDamping(): number;
public getAngularDamping(): number;
public setDamping(lin_damping: number, ang_damping: number): void;
public setMassProps(mass: number, inertia: btVector3): void;
public setLinearFactor(linearFactor: btVector3): void;
public applyTorque(torque: btVector3): void;
public applyLocalTorque(torque: btVector3): void;
public applyForce(force: btVector3, rel_pos: btVector3): void;
public applyCentralForce(force: btVector3): void;
public applyCentralLocalForce(force: btVector3): void;
public applyTorqueImpulse(torque: btVector3): void;
public applyImpulse(impulse: btVector3, rel_pos: btVector3): void;
public applyCentralImpulse(impulse: btVector3): void;
public updateInertiaTensor(): void;
public getLinearVelocity(): btVector3;
public getAngularVelocity(): btVector3;
public setLinearVelocity(lin_vel: btVector3): void;
public setAngularVelocity(ang_vel: btVector3): void;
public getMotionState(): btMotionState;
public setMotionState(motionState: btMotionState): void;
public setAngularFactor(angularFactor: btVector3): void;
public getAngularFactor(): btVector3;
public getLinearFactor(): btVector3;
public upcast(colObj: btCollisionObject): btRigidBody;
public getAabb(aabbMin: btVector3, aabbMax: btVector3): void;
public applyGravity(): void;
public getGravity(): btVector3;
public setGravity(acceleration: btVector3): void;
public getBroadphaseProxy(): btBroadphaseProxy;
public getFlags(): number;
public setFlags(flags: number): void;
public wantsSleeping(): boolean;
public clearForces(): void;
public getTotalForce(): btVector3;
public getTotalTorque(): btVector3;
//XXX
public clearState(): void;
}
class btConstraintSetting {
public m_tau: number;
public m_damping: number;
public m_impulseClamp: number;
constructor();
}
class btTypedConstraint {
public enableFeedback(needsFeedback: boolean): void;
public getBreakingImpulseThreshold(): number;
public setBreakingImpulseThreshold(threshold: number): void;
public getParam(num: number, axis: number): number;
public setParam(num: number, value: number, axis: number): void;
}
enum btConstraintParams {
BT_CONSTRAINT_ERP,
BT_CONSTRAINT_STOP_ERP,
BT_CONSTRAINT_CFM,
BT_CONSTRAINT_STOP_CFM,
}
class btPoint2PointConstraint extends btTypedConstraint {
public m_setting: btConstraintSetting;
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
pivotInA: btVector3,
pivotInB: btVector3,
);
constructor(rbA: btRigidBody, pivotInA: btVector3);
public setPivotA(pivotA: btVector3): void;
public setPivotB(pivotB: btVector3): void;
public getPivotInA(): btVector3;
public getPivotInB(): btVector3;
}
class btGeneric6DofConstraint extends btTypedConstraint {
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
frameInA: btTransform,
frameInB: btTransform,
useLinearFrameReferenceFrameA: boolean,
);
constructor(
rbB: btRigidBody,
frameInB: btTransform,
useLinearFrameReferenceFrameB: boolean,
);
public setLinearLowerLimit(linearLower: btVector3): void;
public setLinearUpperLimit(linearUpper: btVector3): void;
public setAngularLowerLimit(angularLower: btVector3): void;
public setAngularUpperLimit(angularUpper: btVector3): void;
public getFrameOffsetA(): btTransform;
}
class btGeneric6DofSpringConstraint extends btGeneric6DofConstraint {
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
frameInA: btTransform,
frameInB: btTransform,
useLinearFrameReferenceFrameA: boolean,
);
constructor(
rbB: btRigidBody,
frameInB: btTransform,
useLinearFrameReferenceFrameB: boolean,
);
public enableSpring(index: number, onOff: boolean): void;
public setStiffness(index: number, stiffness: number): void;
public setDamping(index: number, damping: number): void;
}
class btSequentialImpulseConstraintSolver {
constructor();
}
class btConeTwistConstraint extends btTypedConstraint {
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
rbAFrame: btTransform,
rbBFrame: btTransform,
);
constructor(rbA: btRigidBody, rbAFrame: btTransform);
public setLimit(limitIndex: number, limitValue: number): void;
public setAngularOnly(angularOnly: boolean): void;
public setDamping(damping: number): void;
public enableMotor(b: boolean): void;
public setMaxMotorImpulse(maxMotorImpulse: number): void;
public setMaxMotorImpulseNormalized(maxMotorImpulse: number): void;
public setMotorTarget(q: btQuaternion): void;
public setMotorTargetInConstraintSpace(q: btQuaternion): void;
}
class btHingeConstraint extends btTypedConstraint {
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
pivotInA: btVector3,
pivotInB: btVector3,
axisInA: btVector3,
axisInB: btVector3,
useReferenceFrameA?: boolean,
);
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
rbAFrame: btTransform,
rbBFrame: btTransform,
useReferenceFrameA?: boolean,
);
constructor(
rbA: btRigidBody,
rbAFrame: btTransform,
useReferenceFrameA?: boolean,
);
public setLimit(
low: number,
high: number,
softness: number,
biasFactor: number,
relaxationFactor?: number,
): void;
public enableAngularMotor(
enableMotor: boolean,
targetVelocity: number,
maxMotorImpulse: number,
): void;
public setAngularOnly(angularOnly: boolean): void;
public enableMotor(enableMotor: boolean): void;
public setMaxMotorImpulse(maxMotorImpulse: number): void;
public setMotorTarget(targetAngle: number, dt: number): void;
}
class btSliderConstraint extends btTypedConstraint {
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
frameInA: btTransform,
frameInB: btTransform,
useLinearReferenceFrameA: boolean,
);
constructor(
rbB: btRigidBody,
frameInB: btTransform,
useLinearReferenceFrameA: boolean,
);
public setLowerLinLimit(lowerLimit: number): void;
public setUpperLinLimit(upperLimit: number): void;
public setLowerAngLimit(lowerAngLimit: number): void;
public setUpperAngLimit(upperAngLimit: number): void;
}
class btFixedConstraint extends btTypedConstraint {
constructor(
rbA: btRigidBody,
rbB: btRigidBody,
frameInA: btTransform,
frameInB: btTransform,
);
}
class btConstraintSolver { }
class btDispatcherInfo {
public m_timeStep: number;
public m_stepCount: number;
public m_dispatchFunc: number;
public m_timeOfImpact: number;
public m_useContinuous: boolean;
public m_enableSatConvex: boolean;
public m_enableSPU: boolean;
public m_useEpa: boolean;
public m_allowedCcdPenetration: number;
public m_useConvexConservativeDistanceUtil: boolean;
public m_convexConservativeDistanceThreshold: number;
}
class btCollisionWorld {
public getDispatcher(): btDispatcher;
public rayTest(
rayFromWorld: btVector3,
rayToWorld: btVector3,
resultCallback: RayResultCallback,
): void;
public rayTestSingle(rayFromWorld: btTransform, rayToWorld: btTransform, co: btCollisionObject, cs: btCollisionShape, coTran: btTransform, resultCallback: RayResultCallback);
public getPairCache(): btOverlappingPairCache;
public getDispatchInfo(): btDispatcherInfo;
public addCollisionObject(
collisionObject: btCollisionObject,
collisionFilterGroup?: number,
collisionFilterMask?: number,
): void;
public removeCollisionObject(collisionObject: btCollisionObject): void;
public getBroadphase(): btBroadphaseInterface;
public convexSweepTest(
castShape: btConvexShape,
from: btTransform,
to: btTransform,
resultCallback: ConvexResultCallback,
allowedCcdPenetration: number,
): void;
public contactPairTest(
colObjA: btCollisionObject,
colObjB: btCollisionObject,
resultCallback: ContactResultCallback,
): void;
public contactTest(
colObj: btCollisionObject,
resultCallback: ContactResultCallback,
): void;
public updateSingleAabb(colObj: btCollisionObject): void;
public setDebugDrawer(debugDrawer: btIDebugDraw): void;
public getDebugDrawer(): btIDebugDraw;
public debugDrawWorld(): void;
public debugDrawObject(
worldTransform: btTransform,
shape: btCollisionShape,
color: btVector3,
): void;
public setContactBreakingThreshold(b: number): void;
}
class btContactSolverInfo {
public m_splitImpulse: boolean;
public m_splitImpulsePenetrationThreshold: number;
public m_numIterations: number;
}
class btDynamicsWorld extends btCollisionWorld {
public addAction(action: btActionInterface): void;
public removeAction(action: btActionInterface): void;
public getSolverInfo(): btContactSolverInfo;
}
class btDiscreteDynamicsWorld extends btDynamicsWorld {
constructor(
dispatcher: btDispatcher,
pairCache: btBroadphaseInterface,
constraintSolver: btConstraintSolver,
collisionConfiguration: btCollisionConfiguration,
);
public setGravity(gravity: btVector3): void;
public getGravity(): btVector3;
public addRigidBody(body: btRigidBody): void;
public addRigidBody(body: btRigidBody, group: number, mask: number): void;
public removeRigidBody(body: btRigidBody): void;
public addConstraint(
constraint: btTypedConstraint,
disableCollisionsBetweenLinkedBodies?: boolean,
): void;
public removeConstraint(constraint: btTypedConstraint): void;
public stepSimulation(
timeStep: number,
maxSubSteps?: number,
fixedTimeStep?: number,
): number;
// Contact callback support
public setContactAddedCallback(funcpointer: number): void;
public setContactProcessedCallback(funcpointer: number): void;
public setContactDestroyedCallback(funcpointer: number): void;
}
class ccDiscreteDynamicsWorld extends btDiscreteDynamicsWorld {
public setAllowSleep(v: boolean): void;
public setDeactivationTime(v: number): void;
public setNarrowPhaseMethod(v: number): void;
public setAllowCcdPenetration(v: number): void;
public setCcdCastCheckResponse(v: boolean): void;
public getCcdTriggerRecorder(): btNumberArray;
}
class btVehicleTuning {
public m_suspensionStiffness: number;
public m_suspensionCompression: number;
public m_suspensionDamping: number;
public m_maxSuspensionTravelCm: number;
public m_frictionSlip: number;
public m_maxSuspensionForce: number;
constructor();
}
class btVehicleRaycasterResult {
public m_hitPointInWorld: btVector3;
public m_hitNormalInWorld: btVector3;
public m_distFraction: number;
}
class btVehicleRaycaster {
public castRay(
from: btVector3,
to: btVector3,
result: btVehicleRaycasterResult,
): void;
}
class btDefaultVehicleRaycaster extends btVehicleRaycaster {
// constructor (world: btDynamicsWorld);
public addAction(action: btActionInterface): void;
public removeAction(action: btActionInterface): void;
public getSolverInfo(): btContactSolverInfo;
}
class RaycastInfo {
public m_contactNormalWS: btVector3;
public m_contactPointWS: btVector3;
public m_suspensionLength: number;
public m_hardPointWS: btVector3;
public m_wheelDirectionWS: btVector3;
public m_wheelAxleWS: btVector3;
public m_isInContact: boolean;
public m_groundObject: any;
}
class btWheelInfoConstructionInfo {
public m_chassisConnectionCS: btVector3;
public m_wheelDirectionCS: btVector3;
public m_wheelAxleCS: btVector3;
public m_suspensionRestLength: number;
public m_maxSuspensionTravelCm: number;
public m_wheelRadius: number;
public m_suspensionStiffness: number;
public m_wheelsDampingCompression: number;
public m_wheelsDampingRelaxation: number;
public m_frictionSlip: number;
public m_maxSuspensionForce: number;
public m_bIsFrontWheel: boolean;
}
class btWheelInfo {
public m_suspensionStiffness: number;
public m_frictionSlip: number;
public m_engineForce: number;
public m_rollInfluence: number;
public m_suspensionRestLength1: number;
public m_wheelsRadius: number;
public m_wheelsDampingCompression: number;
public m_wheelsDampingRelaxation: number;
public m_steering: number;