Commit graph

1402 commits

Author SHA1 Message Date
PouleyKetchoupp ed1ba5093f Clarify RigidDynamicBody modes
RigidDynamicBody modes are replaced with several properties to make their
usage clearer:
-lock_rotation: disable body's rotation (instead of MODE_LOCKED)
-freeze: no gravity or forces (instead of MODE_STATIC and MODE_KINEMATIC)
-freeze_mode: Static (can be only teleported) or Kinematic (can be animated)

Also renamed MODE_DYNAMIC_LOCKED to MODE_DYNAMIC_LINEAR in the physics
servers.
2021-09-16 16:03:48 -07:00
Camille Mohr-Daurat 3581b893ed
Merge pull request #52681 from nekomatata/rename-rigid-body
Rename RigidBody to RigidDynamicBody and SoftBody to SoftDynamicBody
2021-09-16 11:20:21 -07:00
PouleyKetchoupp 85819b199a Rename RigidBody to RigidDynamicBody and SoftBody to SoftDynamicBody 2021-09-16 09:55:20 -07:00
fabriceci 04a53f86d0 Retrieve platform layer from PhysicsServer2D 2021-09-16 12:31:55 +02:00
Rémi Verschelde eb1262f6ea
Merge pull request #52308 from rxlecky/parallax-layer-position-reset-fix-issue-51914
Fix ParallaxLayer's transform resetting in editor
2021-09-15 13:16:56 +02:00
Gilles Roudière 173c0f8737
Merge pull request #52622 from rileylyman/tilemap-crash
Break TileMap _clear_internals out from _recreate_internals
2021-09-15 09:39:36 +02:00
Riley Lyman dfcf4491d6 Break TileMap _clear_internals out from _recreate_internals 2021-09-14 20:45:10 -07:00
Gilles Roudière 73cc6f94bf Fix transform of TileMap nodes and tilemap selection 2021-09-14 12:18:36 +02:00
Max Hilbrunner 8f8744a563
Merge pull request #52433 from groud/document_tiles
Tiles renames and documentation
2021-09-10 16:32:19 +02:00
Juan Linietsky d0a7eeaaff
Merge pull request #44844 from KoBeWi/hey_listen!_but_2d
Add Listener2D
2021-09-09 19:19:10 -03:00
Gilles Roudière 0c85f3acc1 Tiles renames/bugfixing and documentation 2021-09-08 15:52:43 +02:00
Juan Linietsky ca11f8ad30
Merge pull request #52237 from ellenhp/polyphony
Add optional polyphonic playback to built-in audio player nodes
2021-09-07 17:38:51 -03:00
Ellen Poe 0e3cab41eb Add polyphony to Audio Stream Player nodes 2021-09-07 09:44:39 -07:00
Juan Linietsky 93aa158b5e
Merge pull request #52277 from groud/implement_array_property_hint
Implement properties arrays in the Inspector.
2021-09-07 11:59:46 -03:00
Gilles Roudière 4bd7700e89 Implement properties arrays in the Inspector. 2021-09-07 09:51:28 +02:00
PouleyKetchoupp 82ea2a7045 Proper support for custom mass properties in 2D/3D physics bodies
Changes:
-Added support for custom inertia and center of mass in 3D
-Added support for custom center of mass in 2D
-Calculated center of mass from shapes in 2D (same as in 3D)
-Fixed mass properties calculation with disabled shapes in 2D/3D
-Removed first_integration which is not used in 2D and doesn't seem to
make a lot of sense (prevents omit_force_integration to work during the
first frame)
-Support for custom inertia on different axes for RigidBody3D
2021-09-06 10:20:16 -07:00
Camille Mohr-Daurat a93fb2655a
Merge pull request #52286 from nekomatata/restore-kinematic-body
Add AnimatableBody inherited from StaticBody for moving platforms
2021-09-06 09:32:46 -07:00
Gilles Roudière a4cd553f42 Fix crash in TileMap physics 2021-09-06 13:11:41 +02:00
SeleckyErik 7741afb55a Fix ParallaxLayer's transform resetting in editor
Disable resetting of ParallaxLayer's position and scale in editor to
allow setting the initial values.
2021-09-01 14:57:14 +02:00
PouleyKetchoupp 83baecdff0 Add AnimatableBody inherited from StaticBody for moving platforms
Instead of having a physics node named Static that can be either Static
or Kinematic, AnimatableBody is added again as a separate node:
-Inherited from StaticBody to make its usage clearer
-Still separated from CharacterBody to make its usage more focused

Properly implemented constant velocity for kinematic bodies in godot
physics servers (induced velocity without actually moving).

Also updated description for the different physics nodes to make their
usage clearer.
2021-08-31 18:14:32 -07:00
Juan Linietsky 7946066577
Merge pull request #49471 from nekomatata/body-state-sync-callback
Clean physics direct body state usage in 2D and 3D physics
2021-08-31 14:30:17 -03:00
Camille Mohr-Daurat 0ee1179c1c
Merge pull request #52279 from fabriceci/delta-double
Change delta type to double in Physics_body_2/3D
2021-08-31 08:25:36 -07:00
kobewi f2cb0a8d4b Add Listener2D 2021-08-31 16:53:14 +02:00
fabriceci f9d548627d delta time as double 2021-08-31 14:32:56 +02:00
fabriceci 1a481c8191 Change platform detection by allowing select layers by type (wall or floor) 2021-08-31 09:59:04 +02:00
Juan Linietsky 07707a3627
Revert "Display a matrix for Node2D and don't display a duplicate origin" 2021-08-29 17:01:07 -03:00
Aaron Franke ee7bb9bbb9
Display a matrix for Node2D and don't display a duplicate origin 2021-08-29 10:34:50 -05:00
Juan Linietsky 54caaa21ce
Merge pull request #51296 from ellenhp/mix_in_audio_server
Move mixing out of the AudioStreamPlayback* nodes
2021-08-27 15:38:20 -03:00
Camille Mohr-Daurat 87f575efdd
Merge pull request #52135 from fabriceci/fix-transmission-velocity-on-wall-4
Remove velocity transmission on_wall when collider is CharacterBody.
2021-08-27 10:56:42 -07:00
Ellen Poe 3598d300cb Do all audio mixing in the AudioServer 2021-08-27 10:41:57 -07:00
fabriceci 4da0cfe459 Remove velocity transmission on_wall when collider is CharacterBody. 2021-08-26 23:02:30 +02:00
PouleyKetchoupp 6a9ed72185 Clean physics direct body state usage in 2D and 3D physics
Use a C++ callback instead of Callable for synchronizing physics nodes' state with physics servers.

Remove usage of PhysicsDirectBodyState in physics nodes when not
necessary.

Store PhysicsDirectBodyState for bodies individually instead of a
singleton to avoid issues when accessing direct body state for multiple
bodies.

PhysicsDirectBodyState is initialized only when needed, so it doesn't
have to be created when using the physics server directly.

Move PhysicsDirectBodyState2D and PhysicsDirectBodyState3D to separate
cpp files.
2021-08-25 08:57:42 -07:00
PouleyKetchoupp d9720d4395 Fix CharacterBody motion with RayShape
Make separation ray shapes work properly in move_and_slide, wihtout the
specific code in CharacterBody like before.

Now most of the logic is handled inside the physics server. The only
thing that's needed is to use ray shapes only for recovery and ignore
them when performing the motion itself (unless we're snapping or slips
on slope is on).
2021-08-24 17:34:55 -07:00
reduz 44d62a9f4b Implement NativeExtension pointer arguments
* Allows calling into native extensions directly with a pointer
* Makes it easier to implement some APIs more efficiently
* Appears with a "*" in the documentation for the argument.
* Implementing the pointer handling is entirely up to the implementation, although the extension API provides some hint.
* AudioStream has been implemented as an example, allowing to create NativeExtension based AudioStreams.
2021-08-23 19:58:40 -03:00
Hugo Locurcio 0af213a4e0
Merge pull request #51259 from nekomatata/fix-tilemap-one-way-collision
Fix one-way collision in Tilemap
2021-08-23 18:54:01 +02:00
reduz 5cecdfa8af Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
2021-08-23 08:10:13 -03:00
QbieShay d6672096fc moved particle parameters to minmax and split scale axis
This commit adds quite a chunk of modifications to particles
- particle (value + randomness) now use min and max instead
- passing a curveXYZtexture is now possible and will scale particles per-axis
- CPUParticle3D have an optional parameter to split the scale curve per-axis
2021-08-22 18:42:17 +02:00
reduz 3682978aee Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe.
* New syntax allows for type safe virtuals in native extensions.
* New syntax permits extremely fast calling.

Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`.
These will require API rework on a separate PR as they work different than the rest of the functions.

Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
2021-08-22 08:23:58 -03:00
fabriceci 68f0cf97bc add motion mode to handle TPS 2021-08-20 17:32:33 +02:00
Rémi Verschelde 4f640762f7
Merge pull request #51881 from KoBeWi/zz__iinnddeexx
Fix z_index applied twice for TileMap layers
2021-08-19 21:30:10 +02:00
ThreeRhinosInAnElephantCostume 78e2d35a7e fixed camera2d's "current" property getting reset when switching scenes 2021-08-19 15:19:19 +02:00
kobewi a7ace9fec1 Fix z_index applied twice for TileMap layers 2021-08-19 12:40:09 +02:00
fabriceci 0cfb7de052 Correct jitter and clean code 2021-08-16 17:17:24 +02:00
fabriceci d776b6c154 API improvement on physics, mainly CharacterBody
Changes:

- Rename few methods/property and group them in the editor when it's possible
- Make MotionResult API consistency with KinematicCollision
- Return a boolean in move_and_slide if there was a collision
- New methods:
  - get_floor_angle on CharacterBody to get the floor angle.
  - get_angle on KinematicCollision to get the collision angle.
  - get_last_slide_collision to quickly get the latest collision of move_and_slide.
2021-08-15 12:53:29 +02:00
Anilforextra c390f0515d Use get_global_* functions instead of using transforms. 2021-08-14 14:01:57 +05:45
Aaron Franke eb4902a455
Fix some unnecessary includes 2021-08-13 00:27:38 -05:00
Aaron Franke 03e2544d50
Use real_t and double where appropriate in Particles 2021-08-12 11:35:31 -05:00
Rémi Verschelde c89ad92c96
Merge pull request #51532 from nekomatata/layer-mask-accessors
Uniformize layer names, script methods and documentation
2021-08-12 17:55:11 +02:00
PouleyKetchoupp 989acbbe81 Uniformize layer names, script methods and documentation
- Back to 1-based layer names to make it clearer in editor UI
- Layer bit accessors are renamed to layer value and 1-based too
- Uniform errors and documentation in render and physics
- Fix a few remaining collision_layer used in place of collision_mask
2021-08-12 08:06:42 -07:00
Rémi Verschelde 78c8b7ffec
Merge pull request #51568 from AnilBK/remove-swap
Remove unused swap template.
2021-08-12 15:52:05 +02:00