Commit Graph

469 Commits

Author SHA1 Message Date
Ricardo Buring aacb20437a PhysicsDirectBodyState2D: add get_contact_local_velocity_at_position 2023-04-14 11:40:06 +02:00
myaaaaaaaaa 6f88392d02 Move some worker_thread_pool.h includes out of header files 2023-02-13 14:02:01 -05:00
Rémi Verschelde b7c0f613b5
Merge pull request #66076 from Sauermann/fix-double-physics-input-events-for-layers
Fix physics events being interpreted twice for nodes in canvas layer
2023-02-01 07:29:16 +01:00
Markus Sauermann 7e056f1b37 Fix physics events being interpreted twice when in canvas layer 2023-01-31 23:14:57 +01:00
smix8 026549db2e Create default World physics spaces on demand only
Changes that the default physics spaces of World resources are only created on first use.
2023-01-31 18:26:52 +01:00
Aaron Franke 79215131b5
Replace Area gravity point distance scale with unit distance 2023-01-29 22:12:00 -06:00
Aaron Franke 866e2b95dc
Remove deprecated AREA_PARAM_GRAVITY_POINT_ATTENUATION 2023-01-29 22:12:00 -06:00
Ricardo Buring 3efa105548 Add get_contact_impulse method to PhysicsDirectBodyState2D
This makes it consistent with 3D.
2023-01-10 23:28:02 +01:00
Rémi Verschelde 163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Geekotron ae55229618 Fix regression 70154 caused by my prior CCD fix.
At high velocities `from - motion *.1` is *behind the RB* - not within its collider as the comment suggested - so it could not be used for determining movement length
2022-12-16 11:39:19 -07:00
Geekotron 57710897d6 Fix Physics3D and Physics2D CCD sometimes adjusting velocity too much (preventing collision) or not enough (allowing tunneling) 2022-12-13 18:01:21 -07:00
kobewi 7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Rémi Verschelde de6994aa95
Merge pull request #69674 from rburing/conStraint
Fix typo in physics step: contraint -> constraint
2022-12-07 13:25:28 +01:00
Ricardo Buring 53e90bd6ca Fix typo in physics step: contraint -> constraint 2022-12-06 17:32:45 +01:00
Ricardo Buring 29ab86aa7d Fix collision detection for degenerate capsules
In GodotCapsuleShape3D::get_supports and
GodotCapsuleShape2D::get_supports, return a point instead of an edge of
length zero in case the capsule degenerates to a sphere or circle.
2022-12-06 14:17:24 +01:00
kobewi d9f066d5fa Remove duplicate project settings definitions 2022-11-08 01:29:39 +01:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde 5b6ccf2fd2 Merge pull request #66720 from qarmin/unintialized_memory
Remove usage of unitialized variables
2022-10-05 11:42:47 +02:00
Rafał Mikrut 2233624152 Remove usage of unitialized variables 2022-10-01 21:09:22 +02:00
Haoyu Qiu 8320e12ac1 Fix crash when executing `PhysicsServer2D.joint_clear` 2022-09-30 10:36:05 +08:00
bruvzg ea1848ce0a
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings. 2022-09-29 10:38:21 +03:00
Rémi Verschelde e5857bd6c7 Merge pull request #66548 from akien-mga/msvc-warnings-c4701-c4703
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
2022-09-28 20:47:50 +02:00
Rémi Verschelde 85fe6ecc32 Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used 2022-09-28 17:05:34 +02:00
Rémi Verschelde 7ab01450cf Fix MSVC warning C4702: unreachable code
Part of #66537.
2022-09-28 16:46:48 +02:00
Mansur Isaev efd4dc20a3 Add `area_get_collision_layer` and `area_get_collision_mask` 2022-09-25 14:34:35 +04:00
Rémi Verschelde 28e1dc6162 Merge pull request #65828 from rburing/body_state_sync_callable
make `body_set_state_sync_callback` take a `Callable`
2022-09-21 11:05:41 +02:00
fabriceci 7a15ccfa7b Warn users when collisions are not supported 2022-09-19 16:51:41 +02:00
Ricardo Buring ff4e72a0bc PhysicsServer2D and PhysicsServer3D: make body_set_state_sync_callback take a Callable
Prefer Callable to a C-style callback. This is helpful for GDExtension.
2022-09-15 15:09:23 +02:00
Rémi Verschelde 6fd3f6a287
Merge pull request #65048 from rburing/solve_static_world_boundary_motion_2d 2022-09-14 23:13:35 +02:00
Jonathan Nicholl 15d057c521 Add `is_zero_approx` methods to `Vector2`, `3`, and `4` 2022-09-02 00:29:50 -04:00
Ricardo Buring 219a582a15 Fix collision solving between world boundary and shapes in motion (2D) 2022-08-29 17:34:06 +02:00
Rémi Verschelde f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Micky 59e11934d8 Rename `str2var` to `str_to_var` and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
fabriceci f8cc88fab3 Restore RigidBody2/3D, SoftBody names in physics 2022-08-26 12:26:25 +02:00
Silc Renew b31115cdc1 Add collision weight to PhysicsBody for penetrations must be avoided
Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2022-08-18 08:10:31 +09:00
Ryan Heath 9d4e5a466e Add area monitor callback error checking 2022-08-07 13:47:03 -07:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Juan Linietsky c7255388e1 Remove ThreadWorkPool, replace by WorkerThreadPool
The former needs to be allocated once per usage. The later is shared for all threads, which is more efficient.
It can also be better debugged.
2022-07-25 15:39:50 +02:00
reduz 141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
reduz 45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Record 900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Ricardo Buring f072aa69a9 Add motion parameter to toggle whether recovery is reported as a collision
This makes the intent explicit in each use case.
2022-05-18 16:40:29 +02:00
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Aaron Franke fa7a7795f0
Rename Basis get_axis to get_column, remove redundant methods 2022-05-03 09:37:47 -05:00
Rémi Verschelde 931838b330
Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
Rémi Verschelde c273ddc3ee Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init`
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Aaron Franke b831fb0a54
Rename Transform2D "elements" to "columns" 2022-04-29 08:02:39 -05:00
bruvzg de4c97758a
Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
bruvzg f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00