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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
|
---@meta
---
---The `lovr.physics` module simulates 3D rigid body physics.
---
---@class lovr.physics
lovr.physics = {}
---
---Creates a new BallJoint.
---
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param x number # The x position of the joint anchor point, in world coordinates.
---@param y number # The y position of the joint anchor point, in world coordinates.
---@param z number # The z position of the joint anchor point, in world coordinates.
---@return lovr.BallJoint ball # The new BallJoint.
function lovr.physics.newBallJoint(colliderA, colliderB, x, y, z) end
---
---Creates a new BoxShape.
---
---@param width? number # The width of the box, in meters.
---@param height? number # The height of the box, in meters.
---@param depth? number # The depth of the box, in meters.
---@return lovr.BoxShape box # The new BoxShape.
function lovr.physics.newBoxShape(width, height, depth) end
---
---Creates a new CapsuleShape. Capsules are cylinders with hemispheres on each end.
---
---@param radius? number # The radius of the capsule, in meters.
---@param length? number # The length of the capsule, not including the caps, in meters.
---@return lovr.CapsuleShape capsule # The new CapsuleShape.
function lovr.physics.newCapsuleShape(radius, length) end
---
---Creates a new CylinderShape.
---
---@param radius? number # The radius of the cylinder, in meters.
---@param length? number # The length of the cylinder, in meters.
---@return lovr.CylinderShape cylinder # The new CylinderShape.
function lovr.physics.newCylinderShape(radius, length) end
---
---Creates a new DistanceJoint.
---
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param x1 number # The x position of the first anchor point, in world coordinates.
---@param y1 number # The y position of the first anchor point, in world coordinates.
---@param z1 number # The z position of the first anchor point, in world coordinates.
---@param x2 number # The x position of the second anchor point, in world coordinates.
---@param y2 number # The y position of the second anchor point, in world coordinates.
---@param z2 number # The z position of the second anchor point, in world coordinates.
---@return lovr.DistanceJoint joint # The new DistanceJoint.
function lovr.physics.newDistanceJoint(colliderA, colliderB, x1, y1, z1, x2, y2, z2) end
---
---Creates a new HingeJoint.
---
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param x number # The x position of the hinge anchor, in world coordinates.
---@param y number # The y position of the hinge anchor, in world coordinates.
---@param z number # The z position of the hinge anchor, in world coordinates.
---@param ax number # The x component of the hinge axis.
---@param ay number # The y component of the hinge axis.
---@param az number # The z component of the hinge axis.
---@return lovr.HingeJoint hinge # The new HingeJoint.
function lovr.physics.newHingeJoint(colliderA, colliderB, x, y, z, ax, ay, az) end
---
---Creates a new SliderJoint.
---
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param ax number # The x component of the slider axis.
---@param ay number # The y component of the slider axis.
---@param az number # The z component of the slider axis.
---@return lovr.SliderJoint slider # The new SliderJoint.
function lovr.physics.newSliderJoint(colliderA, colliderB, ax, ay, az) end
---
---Creates a new SphereShape.
---
---@param radius? number # The radius of the sphere, in meters.
---@return lovr.SphereShape sphere # The new SphereShape.
function lovr.physics.newSphereShape(radius) end
---
---Creates a new physics World, which tracks the overall physics simulation, holds collider objects, and resolves collisions between them.
---
---@param xg? number # The x component of the gravity force.
---@param yg? number # The y component of the gravity force.
---@param zg? number # The z component of the gravity force.
---@param allowSleep? boolean # Whether or not colliders will automatically be put to sleep.
---@param tags? table # A list of collision tags colliders can be assigned to.
---@return lovr.World world # A whole new World.
function lovr.physics.newWorld(xg, yg, zg, allowSleep, tags) end
---
---A BallJoint is a type of `Joint` that acts like a ball and socket between two colliders. It allows the colliders to rotate freely around an anchor point, but does not allow the colliders' distance from the anchor point to change.
---
---@class lovr.BallJoint
local BallJoint = {}
---
---Returns the anchor points of the BallJoint, in world coordinates. The first point is the anchor on the first collider, and the second point is on the second collider. The joint tries to keep these points the same, but they may be different if the joint is forced apart by some other means.
---
---@return number x1 # The x coordinate of the first anchor point, in world coordinates.
---@return number y1 # The y coordinate of the first anchor point, in world coordinates.
---@return number z1 # The z coordinate of the first anchor point, in world coordinates.
---@return number x2 # The x coordinate of the second anchor point, in world coordinates.
---@return number y2 # The y coordinate of the second anchor point, in world coordinates.
---@return number z2 # The z coordinate of the second anchor point, in world coordinates.
function BallJoint:getAnchors() end
---
---Returns the response time of the joint. See `World:setResponseTime` for more info.
---
---@return number responseTime # The response time setting for the joint.
function BallJoint:getResponseTime() end
---
---Returns the tightness of the joint. See `World:setTightness` for how this affects the joint.
---
---@return number tightness # The tightness of the joint.
function BallJoint:getTightness() end
---
---Sets a new anchor point for the BallJoint.
---
---@param x number # The x coordinate of the anchor point, in world coordinates.
---@param y number # The y coordinate of the anchor point, in world coordinates.
---@param z number # The z coordinate of the anchor point, in world coordinates.
function BallJoint:setAnchor(x, y, z) end
---
---Sets the response time of the joint. See `World:setResponseTime` for more info.
---
---@param responseTime number # The new response time setting for the joint.
function BallJoint:setResponseTime(responseTime) end
---
---Sets the tightness of the joint. See `World:setTightness` for how this affects the joint.
---
---@param tightness number # The tightness of the joint.
function BallJoint:setTightness(tightness) end
---
---A type of `Shape` that can be used for cubes or boxes.
---
---@class lovr.BoxShape
local BoxShape = {}
---
---Returns the width, height, and depth of the BoxShape.
---
---@return number width # The width of the box, in meters.
---@return number height # The height of the box, in meters.
---@return number depth # The depth of the box, in meters.
function BoxShape:getDimensions() end
---
---Sets the width, height, and depth of the BoxShape.
---
---@param width number # The width of the box, in meters.
---@param height number # The height of the box, in meters.
---@param depth number # The depth of the box, in meters.
function BoxShape:setDimensions(width, height, depth) end
---
---A type of `Shape` that can be used for capsule-shaped things.
---
---@class lovr.CapsuleShape
local CapsuleShape = {}
---
---Returns the length of the CapsuleShape, not including the caps.
---
---@return number length # The length of the capsule, in meters.
function CapsuleShape:getLength() end
---
---Returns the radius of the CapsuleShape.
---
---@return number radius # The radius of the capsule, in meters.
function CapsuleShape:getRadius() end
---
---Sets the length of the CapsuleShape.
---
---@param length number # The new length, in meters, not including the caps.
function CapsuleShape:setLength(length) end
---
---Sets the radius of the CapsuleShape.
---
---@param radius number # The new radius, in meters.
function CapsuleShape:setRadius(radius) end
---
---Colliders are objects that represent a single rigid body in a physics simulation. They can have forces applied to them and collide with other colliders.
---
---@class lovr.Collider
local Collider = {}
---
---Attaches a Shape to the collider. Attached shapes will collide with other shapes in the world.
---
---@param shape lovr.Shape # The Shape to attach.
function Collider:addShape(shape) end
---
---Applies a force to the Collider.
---
---@overload fun(x: number, y: number, z: number, px: number, py: number, pz: number)
---@param x number # The x component of the force to apply.
---@param y number # The y component of the force to apply.
---@param z number # The z component of the force to apply.
function Collider:applyForce(x, y, z) end
---
---Applies torque to the Collider.
---
---@param x number # The x component of the torque.
---@param y number # The y component of the torque.
---@param z number # The z component of the torque.
function Collider:applyTorque(x, y, z) end
---
---Destroy the Collider, removing it from the World.
---
function Collider:destroy() end
---
---Returns the bounding box for the Collider, computed from attached shapes.
---
---@return number minx # The minimum x coordinate of the box.
---@return number maxx # The maximum x coordinate of the box.
---@return number miny # The minimum y coordinate of the box.
---@return number maxy # The maximum y coordinate of the box.
---@return number minz # The minimum z coordinate of the box.
---@return number maxz # The maximum z coordinate of the box.
function Collider:getAABB() end
---
---Returns the angular damping parameters of the Collider. Angular damping makes things less "spinny", making them slow down their angular velocity over time.
---
---@return number damping # The angular damping.
---@return number threshold # Velocity limit below which the damping is not applied.
function Collider:getAngularDamping() end
---
---Returns the angular velocity of the Collider.
---
---@return number vx # The x component of the angular velocity.
---@return number vy # The y component of the angular velocity.
---@return number vz # The z component of the angular velocity.
function Collider:getAngularVelocity() end
---
---Returns the friction of the Collider. By default, the friction of two Colliders is combined (multiplied) when they collide to generate a friction force. The initial friction is 0.
---
---@return number friction # The friction of the Collider.
function Collider:getFriction() end
---
---Returns a list of Joints attached to the Collider.
---
---@return table joints # A list of Joints attached to the Collider.
function Collider:getJoints() end
---
---Returns the Collider's linear damping parameters. Linear damping is similar to drag or air resistance, slowing the Collider down over time.
---
---@return number damping # The linear damping.
---@return number threshold # Velocity limit below which the damping is not applied.
function Collider:getLinearDamping() end
---
---Returns the linear velocity of the Collider. This is how fast the Collider is moving. There is also angular velocity, which is how fast the Collider is spinning.
---
---@return number vx # The x velocity of the Collider, in meters per second.
---@return number vy # The y velocity of the Collider, in meters per second.
---@return number vz # The z velocity of the Collider, in meters per second.
function Collider:getLinearVelocity() end
---
---Returns the linear velocity of a point relative to the Collider.
---
---@param x number # The x coordinate.
---@param y number # The y coordinate.
---@param z number # The z coordinate.
---@return number vx # The x component of the velocity of the point.
---@return number vy # The y component of the velocity of the point.
---@return number vz # The z component of the velocity of the point.
function Collider:getLinearVelocityFromLocalPoint(x, y, z) end
---
---Returns the linear velocity of a point on the Collider specified in world space.
---
---@param x number # The x coordinate in world space.
---@param y number # The y coordinate in world space.
---@param z number # The z coordinate in world space.
---@return number vx # The x component of the velocity of the point.
---@return number vy # The y component of the velocity of the point.
---@return number vz # The z component of the velocity of the point.
function Collider:getLinearVelocityFromWorldPoint(x, y, z) end
---
---Returns the Collider's center of mass.
---
---@return number cx # The x position of the center of mass.
---@return number cy # The y position of the center of mass.
---@return number cz # The z position of the center of mass.
function Collider:getLocalCenter() end
---
---Converts a point from world coordinates into local coordinates relative to the Collider.
---
---@param wx number # The x coordinate of the world point.
---@param wy number # The y coordinate of the world point.
---@param wz number # The z coordinate of the world point.
---@return number x # The x position of the local-space point.
---@return number y # The y position of the local-space point.
---@return number z # The z position of the local-space point.
function Collider:getLocalPoint(wx, wy, wz) end
---
---Converts a direction vector from world space to local space.
---
---@param wx number # The x component of the world vector.
---@param wy number # The y component of the world vector.
---@param wz number # The z component of the world vector.
---@return number x # The x coordinate of the local vector.
---@return number y # The y coordinate of the local vector.
---@return number z # The z coordinate of the local vector.
function Collider:getLocalVector(wx, wy, wz) end
---
---Returns the total mass of the Collider. The mass of a Collider depends on its attached shapes.
---
---@return number mass # The mass of the Collider, in kilograms.
function Collider:getMass() end
---
---Computes mass properties for the Collider.
---
---@return number cx # The x position of the center of mass.
---@return number cy # The y position of the center of mass.
---@return number cz # The z position of the center of mass.
---@return number mass # The computed mass of the Collider.
---@return table inertia # A table containing 6 values of the rotational inertia tensor matrix. The table contains the 3 diagonal elements of the matrix (upper left to bottom right), followed by the 3 elements of the upper right portion of the 3x3 matrix.
function Collider:getMassData() end
---
---Returns the orientation of the Collider in angle/axis representation.
---
---@return number angle # The number of radians the Collider is rotated around its axis of rotation.
---@return number ax # The x component of the axis of rotation.
---@return number ay # The y component of the axis of rotation.
---@return number az # The z component of the axis of rotation.
function Collider:getOrientation() end
---
---Returns the position and orientation of the Collider.
---
---@return number x # The x position of the Collider, in meters.
---@return number y # The y position of the Collider, in meters.
---@return number z # The z position of the Collider, in meters.
---@return number angle # The number of radians the Collider is rotated around its axis of rotation.
---@return number ax # The x component of the axis of rotation.
---@return number ay # The y component of the axis of rotation.
---@return number az # The z component of the axis of rotation.
function Collider:getPose() end
---
---Returns the position of the Collider.
---
---@return number x # The x position of the Collider, in meters.
---@return number y # The y position of the Collider, in meters.
---@return number z # The z position of the Collider, in meters.
function Collider:getPosition() end
---
---Returns the restitution (bounciness) of the Collider. By default, the restitution of two Colliders is combined (the max is used) when they collide to cause them to bounce away from each other. The initial restitution is 0.
---
---@return number restitution # The restitution of the Collider.
function Collider:getRestitution() end
---
---Returns a list of Shapes attached to the Collider.
---
---@return table shapes # A list of Shapes attached to the Collider.
function Collider:getShapes() end
---
---Returns the Collider's tag.
---
---@return string tag # The Collider's collision tag.
function Collider:getTag() end
---
---Returns the user data associated with the Collider.
---
---@return any data # The custom value associated with the Collider.
function Collider:getUserData() end
---
---Returns the World the Collider is in.
---
---@return lovr.World world # The World the Collider is in.
function Collider:getWorld() end
---
---Convert a point relative to the collider to a point in world coordinates.
---
---@param x number # The x position of the point.
---@param y number # The y position of the point.
---@param z number # The z position of the point.
---@return number wx # The x coordinate of the world point.
---@return number wy # The y coordinate of the world point.
---@return number wz # The z coordinate of the world point.
function Collider:getWorldPoint(x, y, z) end
---
---Converts a direction vector from local space to world space.
---
---@param x number # The x coordinate of the local vector.
---@param y number # The y coordinate of the local vector.
---@param z number # The z coordinate of the local vector.
---@return number wx # The x component of the world vector.
---@return number wy # The y component of the world vector.
---@return number wz # The z component of the world vector.
function Collider:getWorldVector(x, y, z) end
---
---Returns whether the Collider is currently awake.
---
---@return boolean awake # Whether the Collider is awake.
function Collider:isAwake() end
---
---Returns whether the Collider is currently ignoring gravity.
---
---@return boolean ignored # Whether gravity is ignored for this Collider.
function Collider:isGravityIgnored() end
---
---Returns whether the Collider is kinematic.
---
---@return boolean kinematic # Whether the Collider is kinematic.
function Collider:isKinematic() end
---
---Returns whether the Collider is allowed to sleep.
---
---@return boolean allowed # Whether the Collider can go to sleep.
function Collider:isSleepingAllowed() end
---
---Removes a Shape from the Collider.
---
---@param shape lovr.Shape # The Shape to remove.
function Collider:removeShape(shape) end
---
---Sets the angular damping of the Collider. Angular damping makes things less "spinny", causing them to slow down their angular velocity over time. Damping is only applied when angular velocity is over the threshold value.
---
---@param damping number # The angular damping.
---@param threshold? number # Velocity limit below which the damping is not applied.
function Collider:setAngularDamping(damping, threshold) end
---
---Sets the angular velocity of the Collider.
---
---@param vx number # The x component of the angular velocity.
---@param vy number # The y component of the angular velocity.
---@param vz number # The z component of the angular velocity.
function Collider:setAngularVelocity(vx, vy, vz) end
---
---Manually puts the Collider to sleep or wakes it up. You can do this if you know a Collider won't be touched for a while or if you need to it be active.
---
---@param awake boolean # Whether the Collider should be awake.
function Collider:setAwake(awake) end
---
---Sets the friction of the Collider. By default, the friction of two Colliders is combined (multiplied) when they collide to generate a friction force. The initial friction is 0.
---
---@param friction number # The new friction.
function Collider:setFriction(friction) end
---
---Sets whether the Collider should ignore gravity.
---
---@param ignored boolean # Whether gravity should be ignored.
function Collider:setGravityIgnored(ignored) end
---
---Sets whether the Collider is kinematic.
---
---@param kinematic boolean # Whether the Collider is kinematic.
function Collider:setKinematic(kinematic) end
---
---Sets the Collider's linear damping parameter. Linear damping is similar to drag or air resistance, slowing the Collider down over time. Damping is only applied when linear velocity is over the threshold value.
---
---@param damping number # The linear damping.
---@param threshold? number # Velocity limit below which the damping is not applied.
function Collider:setLinearDamping(damping, threshold) end
---
---Sets the linear velocity of the Collider directly. Usually it's preferred to use `Collider:applyForce` to change velocity since instantaneous velocity changes can lead to weird glitches.
---
---@param vx number # The x velocity of the Collider, in meters per second.
---@param vy number # The y velocity of the Collider, in meters per second.
---@param vz number # The z velocity of the Collider, in meters per second.
function Collider:setLinearVelocity(vx, vy, vz) end
---
---Sets the total mass of the Collider.
---
---@param mass number # The new mass for the Collider, in kilograms.
function Collider:setMass(mass) end
---
---Sets mass properties for the Collider.
---
---@param cx number # The x position of the center of mass.
---@param cy number # The y position of the center of mass.
---@param cz number # The z position of the center of mass.
---@param mass number # The computed mass of the Collider.
---@param inertia table # A table containing 6 values of the rotational inertia tensor matrix. The table contains the 3 diagonal elements of the matrix (upper left to bottom right), followed by the 3 elements of the upper right portion of the 3x3 matrix.
function Collider:setMassData(cx, cy, cz, mass, inertia) end
---
---Sets the orientation of the Collider in angle/axis representation.
---
---@param angle number # The number of radians the Collider is rotated around its axis of rotation.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
---@param az number # The z component of the axis of rotation.
function Collider:setOrientation(angle, ax, ay, az) end
---
---Sets the position and orientation of the Collider.
---
---@param x number # The x position of the Collider, in meters.
---@param y number # The y position of the Collider, in meters.
---@param z number # The z position of the Collider, in meters.
---@param angle number # The number of radians the Collider is rotated around its axis of rotation.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
---@param az number # The z component of the axis of rotation.
function Collider:setPose(x, y, z, angle, ax, ay, az) end
---
---Sets the position of the Collider.
---
---@param x number # The x position of the Collider, in meters.
---@param y number # The y position of the Collider, in meters.
---@param z number # The z position of the Collider, in meters.
function Collider:setPosition(x, y, z) end
---
---Sets the restitution (bounciness) of the Collider. By default, the restitution of two Colliders is combined (the max is used) when they collide to cause them to bounce away from each other. The initial restitution is 0.
---
---@param restitution number # The new restitution.
function Collider:setRestitution(restitution) end
---
---Sets whether the Collider is allowed to sleep.
---
---@param allowed boolean # Whether the Collider can go to sleep.
function Collider:setSleepingAllowed(allowed) end
---
---Sets the Collider's tag.
---
---@param tag string # The Collider's collision tag.
function Collider:setTag(tag) end
---
---Associates a custom value with the Collider.
---
---@param data any # The custom value to associate with the Collider.
function Collider:setUserData(data) end
---
---A type of `Shape` that can be used for cylinder-shaped things.
---
---@class lovr.CylinderShape
local CylinderShape = {}
---
---Returns the length of the CylinderShape.
---
---@return number length # The length of the cylinder, in meters.
function CylinderShape:getLength() end
---
---Returns the radius of the CylinderShape.
---
---@return number radius # The radius of the cylinder, in meters.
function CylinderShape:getRadius() end
---
---Sets the length of the CylinderShape.
---
---@param length number # The new length, in meters.
function CylinderShape:setLength(length) end
---
---Sets the radius of the CylinderShape.
---
---@param radius number # The new radius, in meters.
function CylinderShape:setRadius(radius) end
---
---A DistanceJoint is a type of `Joint` that tries to keep two colliders a fixed distance apart. The distance is determined by the initial distance between the anchor points. The joint allows for rotation on the anchor points.
---
---@class lovr.DistanceJoint
local DistanceJoint = {}
---
---Returns the anchor points of the DistanceJoint.
---
---@return number x1 # The x coordinate of the first anchor point, in world coordinates.
---@return number y1 # The y coordinate of the first anchor point, in world coordinates.
---@return number z1 # The z coordinate of the first anchor point, in world coordinates.
---@return number x2 # The x coordinate of the second anchor point, in world coordinates.
---@return number y2 # The y coordinate of the second anchor point, in world coordinates.
---@return number z2 # The z coordinate of the second anchor point, in world coordinates.
function DistanceJoint:getAnchors() end
---
---Returns the target distance for the DistanceJoint. The joint tries to keep the Colliders this far apart.
---
---@return number distance # The target distance.
function DistanceJoint:getDistance() end
---
---Returns the response time of the joint. See `World:setResponseTime` for more info.
---
---@return number responseTime # The response time setting for the joint.
function DistanceJoint:getResponseTime() end
---
---Returns the tightness of the joint. See `World:setTightness` for how this affects the joint.
---
---@return number tightness # The tightness of the joint.
function DistanceJoint:getTightness() end
---
---Sets the anchor points of the DistanceJoint.
---
---@param x1 number # The x coordinate of the first anchor point, in world coordinates.
---@param y1 number # The y coordinate of the first anchor point, in world coordinates.
---@param z1 number # The z coordinate of the first anchor point, in world coordinates.
---@param x2 number # The x coordinate of the second anchor point, in world coordinates.
---@param y2 number # The y coordinate of the second anchor point, in world coordinates.
---@param z2 number # The z coordinate of the second anchor point, in world coordinates.
function DistanceJoint:setAnchors(x1, y1, z1, x2, y2, z2) end
---
---Sets the target distance for the DistanceJoint. The joint tries to keep the Colliders this far apart.
---
---@param distance number # The new target distance.
function DistanceJoint:setDistance(distance) end
---
---Sets the response time of the joint. See `World:setResponseTime` for more info.
---
---@param responseTime number # The new response time setting for the joint.
function DistanceJoint:setResponseTime(responseTime) end
---
---Sets the tightness of the joint. See `World:setTightness` for how this affects the joint.
---
---@param tightness number # The tightness of the joint.
function DistanceJoint:setTightness(tightness) end
---
---A HingeJoint is a type of `Joint` that only allows colliders to rotate on a single axis.
---
---@class lovr.HingeJoint
local HingeJoint = {}
---
---Returns the anchor points of the HingeJoint.
---
---@return number x1 # The x coordinate of the first anchor point, in world coordinates.
---@return number y1 # The y coordinate of the first anchor point, in world coordinates.
---@return number z1 # The z coordinate of the first anchor point, in world coordinates.
---@return number x2 # The x coordinate of the second anchor point, in world coordinates.
---@return number y2 # The y coordinate of the second anchor point, in world coordinates.
---@return number z2 # The z coordinate of the second anchor point, in world coordinates.
function HingeJoint:getAnchors() end
---
---Get the angle between the two colliders attached to the HingeJoint. When the joint is created or when the anchor or axis is set, the current angle is the new "zero" angle.
---
---@return number angle # The hinge angle, in radians.
function HingeJoint:getAngle() end
---
---Returns the axis of the hinge.
---
---@return number x # The x component of the axis.
---@return number y # The y component of the axis.
---@return number z # The z component of the axis.
function HingeJoint:getAxis() end
---
---Returns the upper and lower limits of the hinge angle. These will be between -π and π.
---
---@return number lower # The lower limit, in radians.
---@return number upper # The upper limit, in radians.
function HingeJoint:getLimits() end
---
---Returns the lower limit of the hinge angle. This will be greater than -π.
---
---@return number limit # The lower limit, in radians.
function HingeJoint:getLowerLimit() end
---
---Returns the upper limit of the hinge angle. This will be less than π.
---
---@return number limit # The upper limit, in radians.
function HingeJoint:getUpperLimit() end
---
---Sets a new anchor point for the HingeJoint.
---
---@param x number # The x coordinate of the anchor point, in world coordinates.
---@param y number # The y coordinate of the anchor point, in world coordinates.
---@param z number # The z coordinate of the anchor point, in world coordinates.
function HingeJoint:setAnchor(x, y, z) end
---
---Sets the axis of the hinge.
---
---@param x number # The x component of the axis.
---@param y number # The y component of the axis.
---@param z number # The z component of the axis.
function HingeJoint:setAxis(x, y, z) end
---
---Sets the upper and lower limits of the hinge angle. These should be between -π and π.
---
---@param lower number # The lower limit, in radians.
---@param upper number # The upper limit, in radians.
function HingeJoint:setLimits(lower, upper) end
---
---Sets the lower limit of the hinge angle. This should be greater than -π.
---
---@param limit number # The lower limit, in radians.
function HingeJoint:setLowerLimit(limit) end
---
---Sets the upper limit of the hinge angle. This should be less than π.
---
---@param limit number # The upper limit, in radians.
function HingeJoint:setUpperLimit(limit) end
---
---A Joint is a physics object that constrains the movement of two Colliders.
---
---@class lovr.Joint
local Joint = {}
---
---Destroy the Joint, removing it from Colliders it's attached to.
---
function Joint:destroy() end
---
---Returns the Colliders the Joint is attached to. All Joints are attached to two colliders.
---
---@return lovr.Collider colliderA # The first Collider.
---@return lovr.Collider colliderB # The second Collider.
function Joint:getColliders() end
---
---Returns the type of the Joint.
---
---@return lovr.JointType type # The type of the Joint.
function Joint:getType() end
---
---Returns the user data associated with the Joint.
---
---@return any data # The custom value associated with the Joint.
function Joint:getUserData() end
---
---Returns whether the Joint is enabled.
---
---@return boolean enabled # Whether the Joint is enabled.
function Joint:isEnabled() end
---
---Enable or disable the Joint.
---
---@param enabled boolean # Whether the Joint should be enabled.
function Joint:setEnabled(enabled) end
---
---Sets the user data associated with the Joint.
---
---@param data any # The custom value associated with the Joint.
function Joint:setUserData(data) end
---
---A Shape is a physics object that can be attached to colliders to define their shape.
---
---@class lovr.Shape
local Shape = {}
---
---Destroy the Shape, removing it from Colliders it's attached to.
---
function Shape:destroy() end
---
---Returns the bounding box for the Shape.
---
---@return number minx # The minimum x coordinate of the box.
---@return number maxx # The maximum x coordinate of the box.
---@return number miny # The minimum y coordinate of the box.
---@return number maxy # The maximum y coordinate of the box.
---@return number minz # The minimum z coordinate of the box.
---@return number maxz # The maximum z coordinate of the box.
function Shape:getAABB() end
---
---Returns the Collider the Shape is attached to.
---
---@return lovr.Collider collider # The Collider the Shape is attached to.
function Shape:getCollider() end
---
---Computes mass properties of the Shape.
---
---@param density number # The density to use, in kilograms per cubic meter.
---@return number cx # The x position of the center of mass.
---@return number cy # The y position of the center of mass.
---@return number cz # The z position of the center of mass.
---@return number mass # The mass of the Shape.
---@return table inertia # A table containing 6 values of the rotational inertia tensor matrix. The table contains the 3 diagonal elements of the matrix (upper left to bottom right), followed by the 3 elements of the upper right portion of the 3x3 matrix.
function Shape:getMass(density) end
---
---Get the orientation of the Shape relative to its Collider.
---
---@return number angle # The number of radians the Shape is rotated.
---@return number ax # The x component of the rotation axis.
---@return number ay # The y component of the rotation axis.
---@return number az # The z component of the rotation axis.
function Shape:getOrientation() end
---
---Get the position of the Shape relative to its Collider.
---
---@return number x # The x offset.
---@return number y # The y offset.
---@return number z # The z offset.
function Shape:getPosition() end
---
---Returns the type of the Shape.
---
---@return lovr.ShapeType type # The type of the Shape.
function Shape:getType() end
---
---Returns the user data associated with the Shape.
---
---@return any data # The custom value associated with the Shape.
function Shape:getUserData() end
---
---Returns whether the Shape is enabled.
---
---@return boolean enabled # Whether the Shape is enabled.
function Shape:isEnabled() end
---
---Returns whether the Shape is a sensor. Sensors do not trigger any collision response, but they still report collisions in `World:collide`.
---
---@return boolean sensor # Whether the Shape is a sensor.
function Shape:isSensor() end
---
---Enable or disable the Shape.
---
---@param enabled boolean # Whether the Shape should be enabled.
function Shape:setEnabled(enabled) end
---
---Set the orientation of the Shape relative to its Collider.
---
---@param angle number # The number of radians the Shape is rotated.
---@param ax number # The x component of the rotation axis.
---@param ay number # The y component of the rotation axis.
---@param az number # The z component of the rotation axis.
function Shape:setOrientation(angle, ax, ay, az) end
---
---Set the position of the Shape relative to its Collider.
---
---@param x number # The x offset.
---@param y number # The y offset.
---@param z number # The z offset.
function Shape:setPosition(x, y, z) end
---
---Sets whether this Shape is a sensor. Sensors do not trigger any collision response, but they still report collisions in `World:collide`.
---
---@param sensor boolean # Whether the Shape should be a sensor.
function Shape:setSensor(sensor) end
---
---Sets the user data associated with the Shape.
---
---@param data any # The custom value associated with the Shape.
function Shape:setUserData(data) end
---
---A SliderJoint is a type of `Joint` that only allows colliders to move on a single axis.
---
---@class lovr.SliderJoint
local SliderJoint = {}
---
---Returns the axis of the slider.
---
---@return number x # The x component of the axis.
---@return number y # The y component of the axis.
---@return number z # The z component of the axis.
function SliderJoint:getAxis() end
---
---Returns the upper and lower limits of the slider position.
---
---@return number lower # The lower limit.
---@return number upper # The upper limit.
function SliderJoint:getLimits() end
---
---Returns the lower limit of the slider position.
---
---@return number limit # The lower limit.
function SliderJoint:getLowerLimit() end
---
---Returns the upper limit of the slider position.
---
---@return number limit # The upper limit.
function SliderJoint:getUpperLimit() end
---
---Sets the axis of the slider.
---
---@param x number # The x component of the axis.
---@param y number # The y component of the axis.
---@param z number # The z component of the axis.
function SliderJoint:setAxis(x, y, z) end
---
---Sets the upper and lower limits of the slider position.
---
---@param lower number # The lower limit.
---@param upper number # The upper limit.
function SliderJoint:setLimits(lower, upper) end
---
---Sets the lower limit of the slider position.
---
---@param limit number # The lower limit.
function SliderJoint:setLowerLimit(limit) end
---
---Sets the upper limit of the slider position.
---
---@param limit number # The upper limit.
function SliderJoint:setUpperLimit(limit) end
---
---A type of `Shape` that can be used for spheres.
---
---@class lovr.SphereShape
local SphereShape = {}
---
---Returns the radius of the SphereShape.
---
---@return number radius # The radius of the sphere, in meters.
function SphereShape:getDimensions() end
---
---Sets the radius of the SphereShape.
---
---@param radius number # The radius of the sphere, in meters.
function SphereShape:setDimensions(radius) end
---
---A World is an object that holds the colliders, joints, and shapes in a physics simulation.
---
---@class lovr.World
local World = {}
---
---Attempt to collide two shapes. Internally this uses joints and forces to ensure the colliders attached to the shapes do not pass through each other. Collisions can be customized using friction and restitution (bounciness) parameters, and default to using a mix of the colliders' friction and restitution parameters. Usually this is called automatically by `World:update`.
---
---@param shapeA lovr.Shape # The first shape.
---@param shapeB lovr.Shape # The second shape.
---@param friction? number # The friction parameter for the collision.
---@param restitution? number # The restitution (bounciness) parameter for the collision.
---@return boolean collided # Whether the shapes collided.
function World:collide(shapeA, shapeB, friction, restitution) end
---
---Detects which pairs of shapes in the world are near each other and could be colliding. After calling this function, the `World:overlaps` iterator can be used to iterate over the overlaps, and `World:collide` can be used to resolve a collision for the shapes (if any). Usually this is called automatically by `World:update`.
---
function World:computeOverlaps() end
---
---Destroy the World!
---
function World:destroy() end
---
---Disables collision between two collision tags.
---
---@param tag1 string # The first tag.
---@param tag2 string # The second tag.
function World:disableCollisionBetween(tag1, tag2) end
---
---Enables collision between two collision tags.
---
---@param tag1 string # The first tag.
---@param tag2 string # The second tag.
function World:enableCollisionBetween(tag1, tag2) end
---
---Returns the angular damping parameters of the World. Angular damping makes things less "spinny", making them slow down their angular velocity over time.
---
---@return number damping # The angular damping.
---@return number threshold # Velocity limit below which the damping is not applied.
function World:getAngularDamping() end
---
---Returns a table of all Colliders in the World.
---
---@overload fun(t: table):table
---@return table colliders # A table of `Collider` objects.
function World:getColliders() end
---
---Returns the gravity of the World.
---
---@return number xg # The x component of the gravity force.
---@return number yg # The y component of the gravity force.
---@return number zg # The z component of the gravity force.
function World:getGravity() end
---
---Returns the linear damping parameters of the World. Linear damping is similar to drag or air resistance, slowing down colliders over time as they move.
---
---@return number damping # The linear damping.
---@return number threshold # Velocity limit below which the damping is not applied.
function World:getLinearDamping() end
---
---Returns the response time factor of the World.
---
---The response time controls how relaxed collisions and joints are in the physics simulation, and functions similar to inertia. A low response time means collisions are resolved quickly, and higher values make objects more spongy and soft.
---
---The value can be any positive number. It can be changed on a per-joint basis for `DistanceJoint` and `BallJoint` objects.
---
---@return number responseTime # The response time setting for the World.
function World:getResponseTime() end
---
---Returns the tightness of the joint. See `World:setTightness` for how this affects the joint.
---
---@return number tightness # The tightness of the joint.
function World:getTightness() end
---
---Returns whether collisions are currently enabled between two tags.
---
---@param tag1 string # The first tag.
---@param tag2 string # The second tag.
---@return boolean enabled # Whether or not two colliders with the specified tags will collide.
function World:isCollisionEnabledBetween(tag1, tag2) end
---
---Returns whether colliders can go to sleep in the World.
---
---@return boolean allowed # Whether colliders can sleep.
function World:isSleepingAllowed() end
---
---Adds a new Collider to the World with a BoxShape already attached.
---
---@param x? number # The x coordinate of the center of the box.
---@param y? number # The y coordinate of the center of the box.
---@param z? number # The z coordinate of the center of the box.
---@param width? number # The total width of the box, in meters.
---@param height? number # The total height of the box, in meters.
---@param depth? number # The total depth of the box, in meters.
---@return lovr.Collider collider # The new Collider.
function World:newBoxCollider(x, y, z, width, height, depth) end
---
---Adds a new Collider to the World with a CapsuleShape already attached.
---
---@param x? number # The x coordinate of the center of the capsule.
---@param y? number # The y coordinate of the center of the capsule.
---@param z? number # The z coordinate of the center of the capsule.
---@param radius? number # The radius of the capsule, in meters.
---@param length? number # The length of the capsule, not including the caps, in meters.
---@return lovr.Collider collider # The new Collider.
function World:newCapsuleCollider(x, y, z, radius, length) end
---
---Adds a new Collider to the World.
---
---@param x? number # The x position of the Collider.
---@param y? number # The y position of the Collider.
---@param z? number # The z position of the Collider.
---@return lovr.Collider collider # The new Collider.
function World:newCollider(x, y, z) end
---
---Adds a new Collider to the World with a CylinderShape already attached.
---
---@param x? number # The x coordinate of the center of the cylinder.
---@param y? number # The y coordinate of the center of the cylinder.
---@param z? number # The z coordinate of the center of the cylinder.
---@param radius? number # The radius of the cylinder, in meters.
---@param length? number # The length of the cylinder, in meters.
---@return lovr.Collider collider # The new Collider.
function World:newCylinderCollider(x, y, z, radius, length) end
---
---Adds a new Collider to the World with a MeshShape already attached.
---
---@overload fun(model: lovr.Model):lovr.Collider
---@param vertices table # The table of vertices in the mesh. Each vertex is a table with 3 numbers.
---@param indices table # A table of triangle indices representing how the vertices are connected in the Mesh.
---@return lovr.Collider collider # The new Collider.
function World:newMeshCollider(vertices, indices) end
---
---Adds a new Collider to the World with a SphereShape already attached.
---
---@param x? number # The x coordinate of the center of the sphere.
---@param y? number # The y coordinate of the center of the sphere.
---@param z? number # The z coordinate of the center of the sphere.
---@param radius? number # The radius of the sphere, in meters.
---@return lovr.Collider collider # The new Collider.
function World:newSphereCollider(x, y, z, radius) end
---
---Returns an iterator that can be used to iterate over "overlaps", or potential collisions between pairs of shapes in the World. This should be called after using `World:detectOverlaps` to compute the list of overlaps. Usually this is called automatically by `World:update`.
---
---@return function iterator # A Lua iterator, usable in a for loop.
function World:overlaps() end
---
---Casts a ray through the World, calling a function every time the ray intersects with a Shape.
---
---@param x1 number # The x coordinate of the starting position of the ray.
---@param y1 number # The y coordinate of the starting position of the ray.
---@param z1 number # The z coordinate of the starting position of the ray.
---@param x2 number # The x coordinate of the ending position of the ray.
---@param y2 number # The y coordinate of the ending position of the ray.
---@param z2 number # The z coordinate of the ending position of the ray.
---@param callback function # The function to call when an intersection is detected.
function World:raycast(x1, y1, z1, x2, y2, z2, callback) end
---
---Sets the angular damping of the World. Angular damping makes things less "spinny", making them slow down their angular velocity over time. Damping is only applied when angular velocity is over the threshold value.
---
---@param damping number # The angular damping.
---@param threshold? number # Velocity limit below which the damping is not applied.
function World:setAngularDamping(damping, threshold) end
---
---Sets the gravity of the World.
---
---@param xg number # The x component of the gravity force.
---@param yg number # The y component of the gravity force.
---@param zg number # The z component of the gravity force.
function World:setGravity(xg, yg, zg) end
---
---Sets the linear damping of the World. Linear damping is similar to drag or air resistance, slowing down colliders over time as they move. Damping is only applied when linear velocity is over the threshold value.
---
---@param damping number # The linear damping.
---@param threshold? number # Velocity limit below which the damping is not applied.
function World:setLinearDamping(damping, threshold) end
---
---Sets the response time factor of the World.
---
---The response time controls how relaxed collisions and joints are in the physics simulation, and functions similar to inertia. A low response time means collisions are resolved quickly, and higher values make objects more spongy and soft.
---
---The value can be any positive number. It can be changed on a per-joint basis for `DistanceJoint` and `BallJoint` objects.
---
---@param responseTime number # The new response time setting for the World.
function World:setResponseTime(responseTime) end
---
---Sets whether colliders can go to sleep in the World.
---
---@param allowed boolean # Whether colliders can sleep.
function World:setSleepingAllowed(allowed) end
---
---Sets the tightness of joints in the World.
---
---The tightness controls how much force is applied to colliders connected by joints. With a value of 0, no force will be applied and joints won't have any effect. With a tightness of 1, a strong force will be used to try to keep the Colliders constrained. A tightness larger than 1 will overcorrect the joints, which can sometimes be desirable. Negative tightness values are not supported.
---
---@param tightness number # The new tightness for the World.
function World:setTightness(tightness) end
---
---Updates the World, advancing the physics simulation forward in time and resolving collisions between colliders in the World.
---
---@param dt number # The amount of time to advance the simulation forward.
---@param resolver? function # The collision resolver function to use. This will be called before updating to allow for custom collision processing. If absent, a default will be used.
function World:update(dt, resolver) end
---
---Represents the different types of physics Joints available.
---
---@alias lovr.JointType
---
---A BallJoint.
---
---| '"ball"'
---
---A DistanceJoint.
---
---| '"distance"'
---
---A HingeJoint.
---
---| '"hinge"'
---
---A SliderJoint.
---
---| '"slider"'
---
---Represents the different types of physics Shapes available.
---
---@alias lovr.ShapeType
---
---A BoxShape.
---
---| '"box"'
---
---A CapsuleShape.
---
---| '"capsule"'
---
---A CylinderShape.
---
---| '"cylinder"'
---
---A SphereShape.
---
---| '"sphere"'
|