Commit a273ce1
authored
Physics engine optimizations (#1997)
* Optimize kinematic body handling
* Faster body to entity syncing and vice versa
* Refactor linear/angularVelocity properties.
* Moved deprecated constants to backwards-compatibility.js
* Only update an entity's transform is the body is active
* Add minimal function for updating kinematic bodies
* Create specific update functions for dynamic and kinematic bodies
* Only activate the body when necessary
* No longer determine body type arrays every frame
* Update comment about component arrays
* Add JSDoc for new internal functions
* Cache for loop lengths
* Temp vars for arrays
* Don't iterate all collision components on every update
* Fix static bodies. Various tidy ups.
* Simplify body creation
* grey -> gray (US spelling)
* Delete unused property on pc.RigidBodyComponent
* Remove constraint code which is currently unused
* set -> force
* Unify trigger and body creation
* Only update transforms of active dynamic bodies
* it's -> its
* Fix lint errors
* Use standard deprecation warning format
* Fixed function signature for _checkForCollisions
* Predicate deprecation warning on DEBUG
* Fix type in deprecation warning
* Move syncBodyToEntity to backwards compatibility file
* Reorder functions
* Unify body creation and destruction code
* Simplify vector creation
* Fix trigger body creation
* Move all update related to physics to the rigidbody component system1 parent 56733b6 commit a273ce1
File tree
8 files changed
+318
-338
lines changed- examples/physics
- src
- framework
- components
- collision
- rigid-body
8 files changed
+318
-338
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 63 | + | |
| 64 | + | |
68 | 65 | | |
69 | 66 | | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
73 | | - | |
| 70 | + | |
| 71 | + | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 74 | | |
80 | 75 | | |
81 | 76 | | |
| |||
137 | 132 | | |
138 | 133 | | |
139 | 134 | | |
140 | | - | |
| 135 | + | |
| 136 | + | |
141 | 137 | | |
142 | 138 | | |
143 | 139 | | |
| |||
154 | 150 | | |
155 | 151 | | |
156 | 152 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | 153 | | |
161 | 154 | | |
162 | 155 | | |
163 | 156 | | |
164 | 157 | | |
165 | 158 | | |
166 | | - | |
| 159 | + | |
| 160 | + | |
167 | 161 | | |
168 | 162 | | |
169 | 163 | | |
| |||
177 | 171 | | |
178 | 172 | | |
179 | 173 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | 174 | | |
185 | 175 | | |
186 | 176 | | |
187 | 177 | | |
188 | | - | |
| 178 | + | |
| 179 | + | |
189 | 180 | | |
190 | 181 | | |
191 | 182 | | |
| |||
200 | 191 | | |
201 | 192 | | |
202 | 193 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 194 | | |
208 | 195 | | |
209 | 196 | | |
210 | 197 | | |
211 | | - | |
| 198 | + | |
| 199 | + | |
212 | 200 | | |
213 | 201 | | |
214 | 202 | | |
| |||
223 | 211 | | |
224 | 212 | | |
225 | 213 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | 214 | | |
231 | 215 | | |
232 | 216 | | |
| |||
263 | 247 | | |
264 | 248 | | |
265 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
266 | 255 | | |
267 | 256 | | |
268 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
19 | 42 | | |
20 | 43 | | |
21 | 44 | | |
| |||
188 | 211 | | |
189 | 212 | | |
190 | 213 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 214 | | |
200 | 215 | | |
201 | 216 | | |
| |||
484 | 499 | | |
485 | 500 | | |
486 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
487 | 524 | | |
488 | 525 | | |
489 | 526 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1514 | 1514 | | |
1515 | 1515 | | |
1516 | 1516 | | |
1517 | | - | |
1518 | 1517 | | |
1519 | 1518 | | |
1520 | 1519 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 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 | + | |
234 | 259 | | |
235 | 260 | | |
236 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | | - | |
| 407 | + | |
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
| |||
587 | 586 | | |
588 | 587 | | |
589 | 588 | | |
590 | | - | |
591 | | - | |
592 | 589 | | |
593 | 590 | | |
594 | 591 | | |
595 | 592 | | |
596 | 593 | | |
597 | 594 | | |
598 | 595 | | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | 596 | | |
609 | 597 | | |
610 | 598 | | |
| |||
704 | 692 | | |
705 | 693 | | |
706 | 694 | | |
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 | 695 | | |
745 | 696 | | |
746 | 697 | | |
| |||
0 commit comments