forked from JayceLai/PhysX
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathphy.d.ts
1736 lines (1378 loc) · 70.7 KB
/
phy.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
interface Vec3 {
x: number, y: number, z: number
}
interface Quat {
x: number, y: number, z: number, w: number
}
interface FilterData {
word0: number
word1: number
word2: number
word3: number
}
declare namespace phy {
/// Base ///
const physics: Physics;
abstract class Physics {
private constructor ()
createCooking (cp: CookingParams): Cooking
createSceneDesc (): SceneDesc
createScene (desc: SceneDesc): Scene
createRigidDynamic (pose: Transform): RigidDynamic
createRigidStatic (pose: Transform): RigidStatic
createMaterial (staticFriction: number, dynamicFriction: number, restitution: number): Material
createShape (geometry: Geometry, material: Material, isExclusive?: boolean | false, shapeFlags?: number): Shape
}
interface Base {
release (): void
}
class CookingParams { }
abstract class Cooking {
createHeightField (desc: HeightFieldDesc): HeightField
createTriangleMesh (desc: TriangleMeshDesc): TriangleMesh
validateTriangleMesh (desc: TriangleMeshDesc): boolean
validateConvexMesh (desc: ConvexMeshDesc): boolean
createConvexMesh (desc: ConvexMeshDesc): ConvexMesh
setParams (params: CookingParams): void
getParams (): CookingParams
}
interface ContactPairHeader {
shapes: Shape[]
pairBuffer: ArrayBuffer
contactBuffer: ArrayBuffer
}
type onContact = (header: ContactPairHeader) => {}
type onTrigger = (pairs: any[], pairsBuffer: ArrayBuffer) => {}
class SimulationEventCallback {
constructor ()
setOnContact (method: onContact): void
setOnTrigger (method: onTrigger): void
}
class SceneDesc {
setFlags (flag: SceneFlag, val: boolean): void //PhysX 中为 setFlag
setGravity (gravity: Vec3): void
setSubThreadCount (val: number): void
getMaxSubThreadCount (): number
setSimulationEventCallback (callback: SimulationEventCallback): void
}
abstract class Scene {
getGravity (): Vec3
setGravity (val: Vec3): void
addActor (actor: Actor): void
removeActor (actor: Actor, wakeOnLostTouch?: boolean | true): void
simulate (elapsedTime: number): void
fetchResults (block?: boolean | true): void
setFlag (flag: SceneFlag, value: boolean): void
getFlags (): number
getPhysics (): Physics
getTimestamp (): number
}
class Bounds3 {
getExtents (): Vec3
getCenter (): Vec3
}
class Transform {
constructor ()
isValid (): boolean
setPosition (pos: Vec3): void
getPosition (): Vec3
setQuaternion (quat: Quat): void
getQuaternion (): Quat
}
abstract class Material implements Base {
private constructor ()
release (): void
setFlag (flag: MaterialFlag, val: boolean): void
setFlags (flags: number): void
setRestitution (val: number): void
setStaticFriction (val: number): void
setDynamicFriction (val: number): void
setFrictionCombineMode (mode: CombineMode): void
setRestitutionCombineMode (mode: CombineMode): void
}
abstract class Shape implements Base {
private constructor ()
release (): void
isExclusive (): boolean
setFlag (flag: ShapeFlag, val: boolean): void
getFlags (): number
setFlags (flags: number): void
setLocalPose (pose: Transform): void
setQueryFilterData (data: FilterData): void
setSimulationFilterData (data: FilterData): void
setMaterials (materials: Array<Material>): void
setRestOffset (val: number): void
setContactOffset (offset: number): void
setGeometry (geometry: Geometry): void
}
/// Actor ///
abstract class Actor implements Base {
release (): void
getType (): number
setUserData (data: number): void
getUserData (): number
setActorFlag (flag: ActorFlag, val: boolean): void
setActorFlags (flags: number): void
getActorFlags (): number
getWorldBounds (inflation?: number | 1.01): Bounds3
setDominanceGroup (val: number): number
getDominanceGroup (): number
}
abstract class RigidActor extends Actor {
setGlobalPose (pose: Transform, autowake?: boolean | true): void
getGlobalPose (): Transform
attachShape (shape: Shape): boolean
getNbShapes (): number
}
class RigidStatic extends RigidActor { }
abstract class RigidBody extends RigidActor {
setMass (val: number): void
getMass (val: number): void
getInvMass (val: number): void
setCMassLocalPose (pose: Transform): void
getCMassLocalPose (): Transform
setLinearDamping (val: number): void
setAngularDamping (val: number): void
setLinearVelocity (val: Vec3, autowake?: boolean | true): void
setAngularVelocity (val: Vec3, autowake?: boolean | true): void
addTorque (torque: Vec3, mode: number, autowake?: boolean | true): void
setRigidBodyFlag (flag: RigidBodyFlag, val: boolean): void
setRigidBodyFlags (flags: number): void
getRigidBodyFlags (flags: number): void
clearForce (mode: number): void
clearTorque (mode: number): void
}
abstract class RigidDynamic extends RigidBody {
wakeUp (): void
isSleeping (): boolean
putToSleep (): void
setKinematicTarget (transform: Transform): void
setWakeCounter (val: number): void
getWakeCounter (): number
setSleepThreshold (val: number): void
getSleepThreshold (): void
setContactReportThreshold (val: number): void
getContactReportThreshold (): number
setStabilizationThreshold (val: number): void
getStabilizationThreshold (): number
setRigidDynamicLockFlag (flag: RigidDynamicLockFlag, val: boolean): void
setRigidDynamicLockFlags (flags: number): void
getRigidDynamicLockFlags (): number
}
/// Character Controller ///
interface ControllerShapeHit {
}
interface ControllersHit {
}
abstract class Controller {
release (): void
move (disp: Vec3, minDist: number, elapsedTime: number,
filterData: FilterData, cb: number): number
setPosition (pos: any): void
getPosition (): any
setStepOffset (val: number): void
getStepOffset (): number
setContactOffset (val: number): void
getContactOffset (): number
setSlopeLimit (val: number): void
getSlopeLimit (): number
setCollision (val: boolean): void
setSimulationFilterData (val: FilterData): void
setQueryFilterData (val: FilterData): void
}
class CapsuleController extends Controller {
constructor ()
setRadius (val: number): void
getRadius (): number
setHeight (val: number): void
getHeight (): number
setClimbingMode (val: number): void
getClimbingMode (): number
}
class BoxController extends Controller {
constructor ()
setHalfHeight (val: number): void
getHalfHeight (): number
setHalfSideExtent(val: number): void
getHalfSideExtent (): number
setHalfForwardExtent (val: number): void
getHalfForwardExtent (): number
}
/// Geometry ///
interface Geometry {
isVaild (): boolean
}
/** Primitive */
class BoxGeometry implements Geometry {
constructor (halfSize: Vec3)
isVaild (): boolean
setHalfExtents (halfSize: Vec3): void
}
class SphereGeometry implements Geometry {
constructor (radius: number)
isVaild (): boolean
setRadius (radius: number): void
}
class PlaneGeometry implements Geometry {
constructor ()
isVaild (): boolean
}
class CapsuleGeometry implements Geometry {
constructor (radius: number, halfHeight: number)
isVaild (): boolean
setRadius (radius: number): void
setHalfHeight (halfHeight: number): void
}
class MeshScale {
constructor (scale: Vec3, rotation: Quat)
isValidForConvexMesh (): boolean
isValidForTriangleMesh (): boolean
hasNegativeDeterminant (): boolean
setScale (scale: Vec3): void
setRotation (rotation: Quat): void
}
/** Triangle Mesh */
class TriangleMeshDesc {
constructor ()
isValid (): boolean
setPointsData (data: Float32Array): void
setPointsCount (count: number): void
setPointsStride (stride: number): void
setTrianglesData (data: Uint32Array | Uint16Array): void
setTrianglesCount (count: number): void
setTrianglesStride (stride: number): void
getMaterialsData (): Uint16Array
setMaterialsData (data: Uint16Array): void
getMaterialsStride (): number
setMaterialsStride (stride: number): void
}
class TriangleMesh implements Base {
private constructor ()
release (): void
getLocalBounds (): Bounds3
}
class TriangleMeshGeometry implements Geometry {
constructor (mesh: TriangleMesh, scale: MeshScale, flags: number)
isVaild (): boolean
setScale (scale: MeshScale): void
setFlags (flags: number): void
setTriangleMesh (mesh: TriangleMesh): void
}
/** Convex Hull */
class ConvexMeshDesc {
isValid (): boolean
setPointsData (data: Float32Array): void
setPointsCount (count: number): void
setPointsStride (stride: number): void
setConvexFlags (flags: number): void
}
class ConvexMesh implements Base {
private constructor ()
release (): void
getLocalBounds (): Bounds3
}
class ConvexMeshGeometry implements Geometry {
constructor (mesh: ConvexMesh, scale: MeshScale, flags: number)
isVaild (): boolean
setScale (scale: MeshScale): void
setFlags (flags: number): void
setTriangleMesh (mesh: TriangleMesh): void
}
/** Height Field */
class HeightFieldDesc {
isValid (): boolean
setNbRows (rows: number): void
setNbColumns (cols: number): void
setSamples (samples: HeightFieldSamples): void
setHeightFieldFlags (flags: number): void
setConvexEdgeThreshold (threshold: number): void
}
class HeightFieldSamples {
setHeightAtIndex (index: number, height: number): void
}
class HeightField implements Base {
private constructor ()
release (): void
}
class HeightFieldGeometry implements Geometry {
constructor (hf: HeightField, heightScale: number, rowScale: number, colScale: number)
isVaild (): boolean
}
/// Joints ///
/// Extensions ///
interface Spring {
stiffness: number
damping: number
}
interface Bounce {
restitution: number
velocityThreshold: number
}
class JointLimitParameters {
protected constructor ()
getRestitution (): number
setRestitution (val: number): void
setBounceThreshold (val: number): void
getBounceThreshold (): number
getStiffness (): number
setStiffness (val: number): void
getDamping (): number
setDamping (val: number): void
getContactDistance (): number
setContactDistance (val: number): void
isValid (): boolean
isSoft (): boolean
}
class JointLinearLimit extends JointLimitParameters {
constructor (extent: number, contactDist?: number | -1)
constructor (extent: number, spring: Spring)
getValue (): number
setValue (val: number): void
}
class JointLinearLimitPair extends JointLimitParameters {
constructor (lowerLimit: number, upperLimit: number, contactDist?: number | -1)
constructor (lowerLimit: number, upperLimit: number, spring: Spring)
getUpper (): number
setUpper (val: number): void
getLower (): number
setLower (val: number): void
}
class JointAngularLimitPair extends JointLimitParameters {
constructor (lowerLimit: number, upperLimit: number, contactDist?: number | -1)
constructor (lowerLimit: number, upperLimit: number, spring: Spring)
getUpper (): number
setUpper (val: number): void
getLower (): number
setLower (val: number): void
}
class JointLimitCone extends JointLimitParameters {
constructor (lowerLimit: number, upperLimit: number, contactDist?: number | -1)
constructor (lowerLimit: number, upperLimit: number, spring: Spring)
getYAngle (): number
setYAngle (val: number): void
getZAngle (): number
setZAngle (val: number): void
}
class JointLimitPyramid extends JointLimitParameters {
constructor (yLimitAngleMin: number, yLimitAngleMax: number, LimitAngleMin: number, zLimitAngleMax: number, contactDist?: number | -1)
constructor (yLimitAngleMin: number, yLimitAngleMax: number, LimitAngleMin: number, zLimitAngleMax: number, spring: Spring)
getYAngleMin (): number
setYAngleMin (val: number): void
getYAngleMax (): number
setYAngleMax (val: number): void
getZAngleMin (): number
setZAngleMin (val: number): void
getZAngleMax (): number
setZAngleMax (val: number): void
}
interface JointBreakForce {
force: number
torque: number
}
class Joint implements Base {
protected constructor ()
release (): void
setActors (actor0: RigidActor, actor1?: RigidActor): void
setLocalPose (index: JointActorIndex, pose: Transform): void
setBreakForce (force: number, torque: number): void
getBreakForce (): JointBreakForce
setConstraintFlag (flag: ConstraintFlag, val: boolean): void
setConstraintFlags (flags: number): void
getConstraintFlags (): number
setInvMassScale0 (val: number): void
setInvInertiaScale0 (val: number): void
setInvMassScale1 (val: number): void
setInvInertiaScale1 (val: number): void
getInvMassScale0 (): number
getInvMassScale1 (): number
getInvInertiaScale0 (): number
getInvInertiaScale1 (): number
getLocalPose (index: JointActorIndex): Transform
getRelativeTransform (): Transform
getRelativeLinearVelocity (): Vec3
getRelativeAngularVelocity (): Vec3
getScene (): Scene | null
}
class RevoluteJoint extends Joint {
private constructor ()
getAngle (): number
getVelocity (): number
getLimit (): JointAngularLimitPair
getDriveVelocity (): number
getDriveForceLimit (): number
getDriveGearRatio (): number
getRevoluteJointFlags (): number
getProjectionLinearTolerance (): number
getProjectionAngularTolerance (): number
setLimit (limit: JointAngularLimitPair): void
setProjectionAngularTolerance (val: number): void
setProjectionLinearTolerance (val: number): void
setRevoluteJointFlags (flags: number): void
setRevoluteJointFlag (flag: RevoluteJointFlag, val: boolean): void
setDriveGearRatio (val: number): void
setDriveForceLimit (val: number): void
setDriveVelocity (val: number, autowake?: boolean | true): void
}
class DistanceJoint extends Joint {
private constructor ()
getDistance (): number
getMinDistance (): number
getMaxDistance (): number
getTolerance (): number
getStiffness (): number
getDamping (): number
getDistanceJointFlags (): number
setDamping (): number
setDistanceJointFlag (flag: DistanceJointFlag, val: boolean): void
setDistanceJointFlags (flags: number): void
setStiffness (val: number): void
setTolerance (val: number): void
setMaxDistance (val: number): void
setMinDistance (val: number): void
}
class FixedJoint extends Joint {
private constructor ()
setProjectionLinearTolerance (val: number): void
setProjectionAngularTolerance (val: number): void
getProjectionAngularTolerance (): number
getProjectionLinearTolerance (): number
}
class PrismaticJoint extends Joint {
private constructor ()
setLimit (limit: JointLinearLimitPair): void
setPrismaticJointFlag (flag: PrismaticJointFlag, val: boolean): void
setPrismaticJointFlags (flags: number): void
setProjectionLinearTolerance (val: number): void
setProjectionAngularTolerance (val: number): void
getPosition (): number
getVelocity (): number
getLimit (): JointLinearLimitPair
getPrismaticJointFlags (): number
getProjectionLinearTolerance (): number
getProjectionAngularTolerance (): number
}
class SphericalJoint extends Joint {
private constructor ()
getLimitCone (): JointLimitCone
setSphericalJointFlag (flag: PrismaticJointFlag, val: boolean): void
getSphericalJointFlags (): number
getProjectionLinearTolerance (): number
setLimitCone (limit: JointLimitCone): void
setSphericalJointFlags (flags: number): void
setProjectionLinearTolerance (val: number): void
}
class ContactJoint extends Joint {
private constructor ()
setContact (val: Vec3): void
setContactNormal (val: Vec3): void
setPenetration (val: number): void
setResititution (val: number): void
setBounceThreshold (val: number): void
getContact (): Vec3
getContactNormal (): Vec3
getPenetration (): number
getResititution (): number
getBounceThreshold (): number
}
class D6JointDrive {
constructor ()
constructor (driveStiffness: number, driveDamping: number, driveForceLimit: number, isAcceleration?: boolean | false)
setForceLimit (val: number): void
getForceLimit (): number
setFlags (flags: number): void
getFlags (): number
setStiffness (val: number): void
getStiffness (): number
setDamping (val: number): void
getDamping (): number
}
interface DriveVelocity {
linear: Vec3
angular: Vec3
}
class D6Joint extends Joint {
private constructor ()
getMotion (axis: D6Axis): D6Motion
getTwistAngle (): number
getSwingYAngle (): number
getSwingZAngle (): number
getDistanceLimit (): JointLinearLimit
getLinearLimit (axis: D6Axis): JointLinearLimitPair
getTwistLimit (): JointAngularLimitPair
getSwingLimit (): JointLimitCone
getPyramidSwingLimit (): JointLimitPyramid
getDrive (index: D6Drive): D6JointDrive
getDrivePosition (): Transform
getDriveVelocity (): DriveVelocity
getProjectionLinearTolerance (): number
getProjectionAngularTolerance (): number
setDriveVelocity (linear: Vec3, angular: Vec3, autowake?: boolean | true): void
setProjectionLinearTolerance (val: number): void
setProjectionAngularTolerance (val: number): void
setLinearLimit (axis: D6Axis, limit: JointLinearLimit): void
setDrive (index: D6Drive, drive: D6JointDrive): void
setDrivePosition (pose: Transform, autowake?: boolean | true): void
setSwingLimit (limit: JointLimitCone): void
setTwistLimit (limit: JointAngularLimitPair): void
setMotion (index: D6Axis, motion: D6Motion): void
setDistanceLimit (limit: JointLinearLimit): void
setPyramidSwingLimit (limit: JointLimitPyramid): void
}
function createRevoluteJoint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): RevoluteJoint
function createContactJoint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): ContactJoint
function createDistanceJoint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): DistanceJoint
function createD6Joint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): D6Joint
function createPrismaticJoint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): PrismaticJoint
function createFixedJoint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): FixedJoint
function createSphericalJoint (actor0: RigidActor, localframe0: Transform, actor1: RigidActor | null, localframe1: Transform): SphericalJoint
/// Extensions ///
namespace ShapeExt {
function getWorldBounds (shape: Shape, actor: RigidActor, inflation?: number | 1.01): Bounds3
}
namespace RigidBodyExt {
function setMassAndUpdateInertia (body: RigidBody, shapeDensities: number | Array<number>, massLoclPose?: Vec3, includeNonSimShapes?: boolean): boolean
function applyImpulse (body: RigidBody, impulse: Vec3, relativePoint: Vec3): void
function applyLocalImpulse (body: RigidBody, localImpulse: Vec3, relativePoint: Vec3): void
function applyForce (body: RigidBody, force: Vec3, relativePoint: Vec3): void
function applyLocalForce (body: RigidBody, localForce: Vec3, relativePoint: Vec3): void
}
class SceneQueryHit {
private constructor ()
actor: RigidActor;
shape: Shape;
faceIndex: number;
}
class RayCastHit {
private constructor ()
actor: RigidActor;
shape: Shape;
faceIndex: number;
u: number;
v: number;
normal: Vec3;
position: Vec3;
distance: number;
flags: number;
}
type preFilter = (filterData: FilterData, shape: Shape, actor: RigidActor, hitFlags: number) => QueryHitType
class QueryFilterCallback {
constructor ()
setPreFilter (cb: preFilter): void
getPreFilter (): preFilter | null
}
namespace SceneQueryExt {
interface SceneQueryFilterData {
data: FilterData
flags: number
}
function raycastSingle (scene: Scene, origin: Vec3, unitDir: Vec3, distacne: number, flags: number, filterData: SceneQueryFilterData, cb: QueryFilterCallback): RayCastHit | null
function raycastAny (scene: Scene, origin: Vec3, unitDir: Vec3, distacne: number, filterData: SceneQueryFilterData, cb: QueryFilterCallback): SceneQueryHit | null
function raycastMultiple (scene: Scene, origin: Vec3, unitDir: Vec3, distacne: number, maxRayCast: number, flags: number, filterData: SceneQueryFilterData, cb: QueryFilterCallback): Array<RayCastHit> | null
}
/// Enum ///
enum Axis {
x,
y,
z
}
enum ContactPairHeaderFlag {
eREMOVED_ACTOR_0 = (1 << 0), //!< The actor with index 0 has been removed from the scene.
eREMOVED_ACTOR_1 = (1 << 1) //!< The actor with index 1 has been removed from the scene.
}
enum ContactPairFlag {
/**
\brief The shape with index 0 has been removed from the actor/scene.
*/
eREMOVED_SHAPE_0 = (1 << 0),
/**
\brief The shape with index 1 has been removed from the actor/scene.
*/
eREMOVED_SHAPE_1 = (1 << 1),
/**
\brief First actor pair contact.
The provided shape pair marks the first contact between the two actors, no other shape pair has been touching prior to the current simulation frame.
\note: This info is only available if #PxPairFlag::eNOTIFY_TOUCH_FOUND has been declared for the pair.
*/
eACTOR_PAIR_HAS_FIRST_TOUCH = (1 << 2),
/**
\brief All contact between the actor pair was lost.
All contact between the two actors has been lost, no shape pairs remain touching after the current simulation frame.
*/
eACTOR_PAIR_LOST_TOUCH = (1 << 3),
/**
\brief Internal flag, used by #PxContactPair.extractContacts()
The applied contact impulses are provided for every contact point.
This is the case if #PxPairFlag::eSOLVE_CONTACT has been set for the pair.
*/
eINTERNAL_HAS_IMPULSES = (1 << 4),
/**
\brief Internal flag, used by #PxContactPair.extractContacts()
The provided contact point information is flipped with regards to the shapes of the contact pair. This mainly concerns the order of the internal triangle indices.
*/
eINTERNAL_CONTACTS_ARE_FLIPPED = (1 << 5)
}
enum PairFlag {
/**
\brief Process the contacts of this collision pair in the dynamics solver.
\note Only takes effect if the colliding actors are rigid bodies.
*/
eSOLVE_CONTACT = (1 << 0),
/**
\brief Call contact modification callback for this collision pair
\note Only takes effect if the colliding actors are rigid bodies.
@see PxContactModifyCallback
*/
eMODIFY_CONTACTS = (1 << 1),
/**
\brief Call contact report callback or trigger callback when this collision pair starts to be in contact.
If one of the two collision objects is a trigger shape (see #PxShapeFlag::eTRIGGER_SHAPE)
then the trigger callback will get called as soon as the other object enters the trigger volume.
If none of the two collision objects is a trigger shape then the contact report callback will get
called when the actors of this collision pair start to be in contact.
\note Only takes effect if the colliding actors are rigid bodies.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_FOUND = (1 << 2),
/**
\brief Call contact report callback while this collision pair is in contact
If none of the two collision objects is a trigger shape then the contact report callback will get
called while the actors of this collision pair are in contact.
\note Triggers do not support this event. Persistent trigger contacts need to be tracked separately by observing eNOTIFY_TOUCH_FOUND/eNOTIFY_TOUCH_LOST events.
\note Only takes effect if the colliding actors are rigid bodies.
\note No report will get sent if the objects in contact are sleeping.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
\note If this flag gets enabled while a pair is in touch already, there will be no eNOTIFY_TOUCH_PERSISTS events until the pair loses and regains touch.
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_PERSISTS = (1 << 3),
/**
\brief Call contact report callback or trigger callback when this collision pair stops to be in contact
If one of the two collision objects is a trigger shape (see #PxShapeFlag::eTRIGGER_SHAPE)
then the trigger callback will get called as soon as the other object leaves the trigger volume.
If none of the two collision objects is a trigger shape then the contact report callback will get
called when the actors of this collision pair stop to be in contact.
\note Only takes effect if the colliding actors are rigid bodies.
\note This event will also get triggered if one of the colliding objects gets deleted.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_LOST = (1 << 4),
/**
\brief Call contact report callback when this collision pair is in contact during CCD passes.
If CCD with multiple passes is enabled, then a fast moving object might bounce on and off the same
object multiple times. Hence, the same pair might be in contact multiple times during a simulation step.
This flag will make sure that all the detected collision during CCD will get reported. For performance
reasons, the system can not always tell whether the contact pair lost touch in one of the previous CCD
passes and thus can also not always tell whether the contact is new or has persisted. eNOTIFY_TOUCH_CCD
just reports when the two collision objects were detected as being in contact during a CCD pass.
\note Only takes effect if the colliding actors are rigid bodies.
\note Trigger shapes are not supported.
\note Only takes effect if eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_CCD = (1 << 5),
/**
\brief Call contact report callback when the contact force between the actors of this collision pair exceeds one of the actor-defined force thresholds.
\note Only takes effect if the colliding actors are rigid bodies.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact()
*/
eNOTIFY_THRESHOLD_FORCE_FOUND = (1 << 6),
/**
\brief Call contact report callback when the contact force between the actors of this collision pair continues to exceed one of the actor-defined force thresholds.
\note Only takes effect if the colliding actors are rigid bodies.
\note If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the
previous one (unless #eNOTIFY_THRESHOLD_FORCE_FOUND has been set in the previous frame).
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact()
*/
eNOTIFY_THRESHOLD_FORCE_PERSISTS = (1 << 7),
/**
\brief Call contact report callback when the contact force between the actors of this collision pair falls below one of the actor-defined force thresholds (includes the case where this collision pair stops being in contact).
\note Only takes effect if the colliding actors are rigid bodies.
\note If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the
previous one (unless #eNOTIFY_THRESHOLD_FORCE_FOUND or #eNOTIFY_THRESHOLD_FORCE_PERSISTS has been set in the previous frame).
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact()
*/
eNOTIFY_THRESHOLD_FORCE_LOST = (1 << 8),
/**
\brief Provide contact points in contact reports for this collision pair.
\note Only takes effect if the colliding actors are rigid bodies and if used in combination with the flags eNOTIFY_TOUCH_... or eNOTIFY_THRESHOLD_FORCE_...
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxContactPair PxContactPair.extractContacts()
*/
eNOTIFY_CONTACT_POINTS = (1 << 9),
/**
\brief This flag is used to indicate whether this pair generates discrete collision detection contacts.
\note Contacts are only responded to if eSOLVE_CONTACT is enabled.
*/
eDETECT_DISCRETE_CONTACT = (1 << 10),
/**
\brief This flag is used to indicate whether this pair generates CCD contacts.
\note The contacts will only be responded to if eSOLVE_CONTACT is enabled on this pair.
\note The scene must have PxSceneFlag::eENABLE_CCD enabled to use this feature.
\note Non-static bodies of the pair should have PxRigidBodyFlag::eENABLE_CCD specified for this feature to work correctly.
\note This flag is not supported with trigger shapes. However, CCD trigger events can be emulated using non-trigger shapes
and requesting eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST and not raising eSOLVE_CONTACT on the pair.
@see PxRigidBodyFlag::eENABLE_CCD
@see PxSceneFlag::eENABLE_CCD
*/
eDETECT_CCD_CONTACT = (1 << 11),
/**
\brief Provide pre solver velocities in contact reports for this collision pair.
If the collision pair has contact reports enabled, the velocities of the rigid bodies before contacts have been solved
will be provided in the contact report callback unless the pair lost touch in which case no data will be provided.
\note Usually it is not necessary to request these velocities as they will be available by querying the velocity from the provided
PxRigidActor object directly. However, it might be the case that the velocity of a rigid body gets set while the simulation is running
in which case the PxRigidActor would return this new velocity in the contact report callback and not the velocity the simulation used.
@see PxSimulationEventCallback.onContact(), PxContactPairVelocity, PxContactPairHeader.extraDataStream
*/
ePRE_SOLVER_VELOCITY = (1 << 12),
/**
\brief Provide post solver velocities in contact reports for this collision pair.
If the collision pair has contact reports enabled, the velocities of the rigid bodies after contacts have been solved
will be provided in the contact report callback unless the pair lost touch in which case no data will be provided.
@see PxSimulationEventCallback.onContact(), PxContactPairVelocity, PxContactPairHeader.extraDataStream
*/
ePOST_SOLVER_VELOCITY = (1 << 13),
/**
\brief Provide rigid body poses in contact reports for this collision pair.
If the collision pair has contact reports enabled, the rigid body poses at the contact event will be provided
in the contact report callback unless the pair lost touch in which case no data will be provided.
\note Usually it is not necessary to request these poses as they will be available by querying the pose from the provided
PxRigidActor object directly. However, it might be the case that the pose of a rigid body gets set while the simulation is running
in which case the PxRigidActor would return this new pose in the contact report callback and not the pose the simulation used.
Another use case is related to CCD with multiple passes enabled, A fast moving object might bounce on and off the same
object multiple times. This flag can be used to request the rigid body poses at the time of impact for each such collision event.
@see PxSimulationEventCallback.onContact(), PxContactPairPose, PxContactPairHeader.extraDataStream
*/
eCONTACT_EVENT_POSE = (1 << 14),
eNEXT_FREE = (1 << 15), //!< For internal use only.
/**
\brief Provided default flag to do simple contact processing for this collision pair.
*/
eCONTACT_DEFAULT = eSOLVE_CONTACT | eDETECT_DISCRETE_CONTACT,
/**
\brief Provided default flag to get commonly used trigger behavior for this collision pair.
*/
eTRIGGER_DEFAULT = eNOTIFY_TOUCH_FOUND | eNOTIFY_TOUCH_LOST | eDETECT_DISCRETE_CONTACT
}
enum TriggerPairFlag {
eREMOVED_SHAPE_TRIGGER = (1 << 0), //!< The trigger shape has been removed from the actor/scene.
eREMOVED_SHAPE_OTHER = (1 << 1), //!< The shape causing the trigger event has been removed from the actor/scene.
eNEXT_FREE = (1 << 2) //!< For internal use only.
}
enum ActorType {
/**
\brief A static rigid body
@see RigidStatic
*/
eRIGID_STATIC,
/**
\brief A dynamic rigid body
@see RigidDynamic
*/
eRIGID_DYNAMIC,
eARTICULATION_LINK
}
enum ActorFlag {
/**
\brief Enable debug renderer for this actor
@see PxScene.getRenderBuffer() PxRenderBuffer PxVisualizationParameter
*/
eVISUALIZATION = (1 << 0),
/**
\brief Disables scene gravity for this actor
*/
eDISABLE_GRAVITY = (1 << 1),
/**
\brief Enables the sending of SimulationEventCallback::onWake() and SimulationEventCallback::onSleep() notify events
@see SimulationEventCallback::onWake() SimulationEventCallback::onSleep()
*/
eSEND_SLEEP_NOTIFIES = (1 << 2),
/**
\brief Disables simulation for the actor.
\note This is only supported by RigidStatic and RigidDynamic actors and can be used to reduce the memory footprint when rigid actors are
used for scene queries only.
\note Setting this flag will remove all constraints attached to the actor from the scene.
\note If this flag is set, the following calls are forbidden:
\li RigidBody: setLinearVelocity(), setAngularVelocity(), addForce(), addTorque(), clearForce(), clearTorque()
\li RigidDynamic: setKinematicTarget(), setWakeCounter(), wakeUp(), putToSleep()
\par <b>Sleeping:</b>
Raising this flag will set all velocities and the wake counter to 0, clear all forces, clear the kinematic target, put the actor
to sleep and wake up all touching actors from the previous frame.
*/
eDISABLE_SIMULATION = (1 << 3)
}
enum RigidBodyFlag {
/**
\brief Enables kinematic mode for the actor.
Kinematic actors are special dynamic actors that are not
influenced by forces (such as gravity), and have no momentum. They are considered to have infinite
mass and can be moved around the world using the setKinematicTarget() method. They will push
regular dynamic actors out of the way. Kinematics will not collide with static or other kinematic objects.
Kinematic actors are great for moving platforms or characters, where direct motion control is desired.
You can not connect Reduced joints to kinematic actors. Lagrange joints work ok if the platform
is moving with a relatively low, uniform velocity.
<b>Sleeping:</b>
\li Setting this flag on a dynamic actor will put the actor to sleep and set the velocities to 0.
\li If this flag gets cleared, the current sleep state of the actor will be kept.