Commit graph

1465 commits

Author SHA1 Message Date
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
Rémi Verschelde f54c5707b5
Merge pull request #50363 from JestemStefan/node2D_zero_scale_det_error
Limit scale of `Node2D` to EPSILON (0.00001) to prevent `det==0` error
2021-08-12 15:40:11 +02:00
Anilforextra e3872a244d Remove unused swap template. 2021-08-12 16:58:03 +05:45
PouleyKetchoupp 4da3a87f7d Remove infinite inertia and ray shapes from CharacterBody
Infinite inertia:
Not needed anymore, since it's now possible to set one-directional
collision layers in order for characters to ignore rigid bodies, while
rigid bodies still collide with characters.

Ray shapes:
They were introduced as a work around to allow constant speed on slopes,
which is now possible with the new property in CharacterBody instead.
2021-08-10 12:10:26 -07:00
fabriceci c6666cc051 Add properties to CharacterBody for more move_and_slide options 2021-08-10 15:57:33 +02:00
Rémi Verschelde 50d5569ad4
Merge pull request #51457 from nekomatata/moving-platforms-3d
Fix 3D moving platform logic
2021-08-10 14:12:01 +02:00
PouleyKetchoupp ec9fed69f4 Fix 3D moving platform logic
Same thing that was already done in 2D, applies moving platform motion
by using a call to move_and_collide that excludes the platform itself,
instead of making it part of the body motion.

Helps with handling walls and slopes correctly when the character walks
on the moving platform.

Also made some minor adjustments to the 2D version and documentation.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-08-09 20:21:04 -07:00
Aaron Franke 430ad75963
Some work on double support 2021-08-09 17:43:48 -05:00
Rémi Verschelde 2de5d2361a
Merge pull request #51446 from nekomatata/fix-moving-platform-rotation
Fix applied rotation from moving platforms in move_and_slide
2021-08-09 23:20:44 +02:00
PouleyKetchoupp 5650c83e4b Fix applied rotation from moving platforms in move_and_slide
When synchronizing CharacterBody motion with moving the platform using
direct body state, only the linear velocity was taken into account.

This change exposes velocity at local point in direct body state and
uses it in move_and_slide to get the proper velocity that includes
rotations.
2021-08-09 12:30:17 -07:00
Aaron Franke 84f720966c
Use doubles for time in many other places 2021-08-09 14:05:42 -05:00
PouleyKetchoupp b9e68c8155 Fix one-way collision in Tilemap
In a given quadrant there can be one or more bodies used, and the
process iterated over cells to add the shapes, so the shape index
doesn't necessarily correspond to the polygon shape index.

Instead body shape indices need to be tracked separately.
2021-08-05 12:10:35 -07:00
kobewi 665dc7805b Fix get_used_rect() calculation 2021-08-05 20:40:21 +02:00
PouleyKetchoupp 7d0a28f875 Fix inverted condition in CharacterBody2D/3D set_max_slides 2021-08-03 19:24:46 -07:00
Gilles Roudière ad8b5cd5a4 Implements TileMap layers and move TileSetPlugins's functions to the TileMap node instead 2021-08-02 13:54:39 +02:00
Rémi Verschelde 63be3c1f00
Merge pull request #50935 from Vitika9/50807 2021-07-30 23:37:07 +02:00
Rémi Verschelde 78f0d2d1d6
Merge pull request #50905 from fabriceci/fix-multiple-direction-collision
Allow multiple collision direction at the same time
2021-07-27 19:10:47 +02:00
vitika9 22eaec6895 Fixed Camera2D's reset_smoothing() does not work as described 2021-07-27 16:29:30 +05:30
Haoyu Qiu 448295cd51 Add check to internal methods to prevent crash 2021-07-27 12:26:13 +08:00
fabriceci f45af43784 Allow to have multiple collision direction at the same time 2021-07-26 19:14:41 +02:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Gilles Roudière 5d34a81e52 Implement atlas merging and tile proxies 2021-07-21 12:36:37 +02:00
Gilles Roudière 047e9b19f8 Import old tiles in SINGLE_TILE mode as atlases 2021-07-21 12:29:51 +02:00
Rémi Verschelde c82daaed48
Merge pull request #38317 from verdog/get-cam-2d-4.0
add viewport.get_camera_2d()
2021-07-20 22:19:06 +02:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Hugo Locurcio 523d6b2ae8
Merge pull request #47395 from sygi/shape_idx_collision
Add shape_idx to CollisionObject2D mouse_entered signal
2021-07-16 19:05:08 +02:00
PouleyKetchoupp d12b44ca13 Move sync to physics to StaticBody2D
Now static body is used for moving platforms through kinematic motion
property, so sync to physics needs to be in StaticBody2D instead of
CharacterBody2D.

Constant kinematic motion is also supported in combination with sync to
physics for smoother movements.
2021-07-15 10:13:27 -07:00
fabriceci cee814e4df Fixing 2D moving platform logic
Fixing by applying the movement in two steps, first the platform
movement, and then the body movement. Plus, add the platform movement
when we are on_wall.
2021-07-15 11:54:43 +02:00
Rémi Verschelde 8f6240a275
Merge pull request #49348 from Geometror/fix-particles-hidden-basecolor
Fix color properties of particle nodes/material
2021-07-14 15:05:20 +02:00
JestemStefan f84ae146f0 Limit scale of node2D to EPSILON 0.00001 to prevent det==0 bug 2021-07-12 11:55:58 +02:00
Hendrik Brucker 3a4a2198ed Fix color properties of particle nodes/material 2021-07-04 02:14:31 +02:00
Josh Chandler 879f84d8f8 add viewport.get_camera_2d()
* there is now a more clear distinction between camera_2d and camera_3d functions in the engine code
* simplified camera2d's exported interface - now everything happens directly with the 'current' variable and make_current and clear_current are no longer exposed- there were some situations where calling one instead of set_current would result in incomplete results
* rebased to current godot master
2021-07-03 15:08:17 -04:00
sygi 6f3e7f7cb0 Add mouse_shape_entered and mouse_shape_exited signals to CollisionObject2D.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-07-02 20:50:27 +01:00
PouleyKetchoupp cf1ddfdb90 Make move_and_slide collision detection more accurate
More accurate unsafe motion calculation
* Safe and unsafe motion are calculated by dichotomy with a limited
number of steps. It's good for performance, but on long motions that
either collide near the beginning or near the end, the result can be
very imprecise.
* Now a factor 0.25 or 0.75 is used to converge faster when this case
happens, which allows longer motions to get more accurate collision
detection.
* Makes snap collision more precise, and helps with cases where diagonal collision on the border of a platform can lead to the character being stuck.

Additional improvements to move_and_slide:
* Handle slide canceling in move_and_collide with 0 velocity instead of
not applying it.
* Better handling of snap with custom logic to cancel sliding.
* Remove small jittering when using stop on slope, by canceling the
motion completely when the resulting motion is less than margin instead
of always projecting to the up direction (in both body motion and snap).

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-07-01 15:15:42 -07:00
Aaron Franke 2508fd0533
Use PROPERTY_USAGE_NONE instead of 0 for no property usage
Also use const more often.
2021-07-01 14:13:27 -04:00
Eric 525ad7c37e Enable Camera2D smoothing on limit change 2021-06-30 16:21:29 -07:00
Rémi Verschelde 915344fe76
Merge pull request #49834 from nekomatata/physics-disable-modes
Add support for controlling physics nodes' behavior when disabled
2021-06-30 20:36:36 +02:00
Rémi Verschelde a02620f3a5
Merge pull request #50009 from reduz/fix-suffixes-and-degrees
Fix editor suffixes and degrees conversion
2021-06-30 18:47:40 +02:00
PouleyKetchoupp 5cbdc7a0ac Add support for controlling physics nodes' behavior when disabled
New property disable_mode to set different behaviors:
Remove: remove from physics simulation
MakeStatic: change body mode to static (doesn't affect area and soft body)
KeepActive: do nothing

Extra change:
Handle disable/enable node state with specific notifications, in order
to differentiate global pause from disabled nodes.
2021-06-30 09:20:44 -07:00
reduz 75688772b3 Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:

* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 12:38:25 -03:00
Rémi Verschelde bcd1fc832f
Merge pull request #49901 from nekomatata/move-and-collide-fix-slide
Fix move_and_collide causing sliding on slopes
2021-06-30 02:18:01 +02:00
Rémi Verschelde 8fb7a9f023
Merge pull request #49719 from LightningAA/rename-node-is-ancestor-of
Rename `is_a_parent_of()` to `is_ancestor_of()`
2021-06-29 12:07:25 +02:00
PouleyKetchoupp 9758a75221 Fix move_and_collide causing sliding on slopes
Make sure the direction of the motion is preserved, unless the depth is
higher than the margin, which means the body needs depenetration in any
direction.

Also changed move_and_slide to avoid sliding on the first motion, in
order to avoid issues with unstable position on ground when jumping.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-06-28 17:17:52 -07:00
Gilles Roudière f8c03151be Fix polygon 2D rendering black 2021-06-24 09:26:51 +02:00
Lightning_A 899e5f8685 Rename is_a_parent_of() to is_ancestor_of() 2021-06-21 08:39:28 -06:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde 3e8620c275
Merge pull request #49475 from nekomatata/kinematic-collision-rid
Expose collider RID in 2D/3D kinematic collision
2021-06-18 12:32:26 +02:00
Aaron Franke 8b692e8872
Add PROPERTY_USAGE_NONE and use it 2021-06-17 19:10:26 -04:00
reduz ab2456b740 Rename VisibilityNotifierXD to VisibleOnScreenNotifierXD
* Renames for 2D and 3D
* Class name was confusing, given both 2D and 3D have a "visible" property that is unrelated to actual on-screen visibility.
* New name makes it clear that this is about visibility on screen.
2021-06-16 22:01:39 -03:00
reduz 38d164c74b Refactor VisibilityNotifier
* Works from RenderinServer
* Accurately tells when on or off-scren, its no longer approximate.
* VisibilityEnabler also simplified to use the process mode instead.
2021-06-16 10:48:57 -03:00
Haoyu Qiu d33185d201 Fix crash when using TileMap::fix_invalid_tiles 2021-06-14 14:58:55 +08:00
Rémi Verschelde ef7974f3d9
Merge pull request #49526 from Chaosus/fix_textureregion_errors 2021-06-13 14:44:50 +02:00
Haoyu Qiu 9cbf066feb Initialize PhysicalBone2D::parent_skeleton 2021-06-13 12:10:11 +08:00
Yuri Roubinsky 19afaa0203 Fixed a bunch of connection errors in TextureEditorPlugin 2021-06-12 08:01:02 +03:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
PouleyKetchoupp 0eb51b31d4 Expose collider RID in 2D/3D kinematic collision
Can be useful to access the colliding body information for bodies
created with the physics server directly.
2021-06-09 18:26:00 -07:00
Rémi Verschelde 38ce1fbe84
Merge pull request #49395 from nekomatata/floor-max-angle-degrees
Use degrees instead of rad for floor_max_angle property in CharacterBody
2021-06-09 09:00:43 +02:00
PouleyKetchoupp 863560c6ef Use degrees instead of rad for floor_max_angle property in CharacterBody 2021-06-08 16:00:31 -07:00
Rémi Verschelde abd2349988
Merge pull request #49378 from BastiaanOlij/fix_execute_modifications_bind
Fixed mistake in binding of Skeleton2D::execute_modifications
2021-06-08 08:16:38 +02:00
Bastiaan Olij 51ab10d3f4 Fixed mistake in binding of Skeleton2D::execute_modifications 2021-06-08 12:18:33 +10:00
Rémi Verschelde d10ace8870
Merge pull request #49128 from Calinou/improve-position-node-axis-visibility
Improve axis awareness and visibility for Position2D and Position3D
2021-06-07 17:38:06 +02:00
TwistedTwigleg 8aa3c2f091 New and improved IK system for Skeleton2D
This PR and commit adds a new IK system for 2D with the Skeleton2D node
that adds several new IK solvers, a way to control bones in a Skeleton2D
node similar to that in Skeleton3D. It also adds additional changes
and functionality.

This work was sponsored by GSoC 2020 and TwistedTwigleg.

Full list of changes:
* Adds a SkeletonModifier2D resource
  * This resource is the base where all IK code is written and executed
  * Has a function for clamping angles, since it is so commonly used
  * Modifiers are unique when duplicated so it works with instancing
* Adds a SkeletonModifierStack2D resource
  * This resource manages a series of SkeletonModification2Ds
  * This is what the Skeleton2D directly interfaces with to make IK possible
* Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in its own file
  * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together
* Adds a PhysicalBone2D node
  * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node
* Changes to Skeleton2D listed below:
  * Skeleton2D now holds a single SkeletonModificationStack2D for IK
  * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D
* Changes to Bone2D listed below:
  * The default_length property has been changed to length. Length is the length of the bone to its child bone node
  * New bone_angle property, which is the angle the bone has to its first child bone node
  * Bone2D caches its transform when not modified by IK for IK interpolation purposes
  * Bone2D draws its own editor gizmo, though this is stated to change in the future
* Changes to CanvasItemEditor listed below:
  * Bone2D gizmo drawing code removed
  * The 2D IK code is removed. Now Bone2D is the only bone system for 2D
* Transform2D now has a looking_at function for rotating to face a position
* Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE
  * These notifications only are called in the editor right before and after saving a scene
  * Needed for not saving the IK position when executing IK in the editor
* Documentation for all the changes listed above.
2021-06-05 15:19:51 -04:00
andriyDev 9f4bf5ec80 Deleted YSort, moved its functionality directly into Node2D.
YSort now has a compatibility alias to Node2D.
Updated TileMap to use the existing Node2D y_sort_enabled property instead
of its own property.
Updated Node2D doc to include the new y_sort_enabled member.
Updated TileMap doc to remove its mention of cell_y_sort.
Deleted YSort doc.
2021-06-05 00:55:25 -07:00
PouleyKetchoupp 23abac9325 Linear velocity cleanup
CharacterBody has a linear_velocity property to replace the argument in
move_and_slide.

StaticBody handles reporting linear/angular velocity correctly when
kinematic motion is used (in 3D, used in vehicle and navigation).
2021-06-04 11:40:36 -07:00
PouleyKetchoupp b2bd9f4e51 Safe margin cleanup
Safe margin property on CharacterBody only, used as argument in
move_and_collide.

Removed kinematic_safe_margin in 3D physics server, not really useful
and now harmonized with 2D.
2021-06-04 11:40:36 -07:00
PouleyKetchoupp 65822559ce Support for kinematic_motion in StaticBody
Does the same thing as simulate motion from RigidBody in Kinematic mode,
and CharacterBody (previously KinematicBody).

Added support for constant linear/angular velocity with kinematic_motion
in StaticBody, which moves the body in physics.

Updated documentation for StaticBody and CharacterBody to describe their
functionalities more accurately.
2021-06-04 11:40:36 -07:00
PouleyKetchoupp ee4b756a51 More explanatory names for RigidBody modes
MODE_DYNAMIC instead of MODE_RIGID
MODE_DYNAMIC_LOCKED instead of MODE_CHARACTER

No more special case for sleeping behavior for MODE_DYNAMIC_LOCKED
(MODE_CHARACTER was forcing the body not to sleep, which is redundant
with can_sleep and wasn't done in Bullet).
2021-06-04 11:40:36 -07:00
PouleyKetchoupp 287c3900fd Properties for move_and_slide and remove move_and_slide_with_snap
- snap property to replace move_and_slide_with_snap()
- floor_max_angle, stop_on_slope, infinite_inertia, max_slides,
up_direction properties to replace arguments from move_and_slide()
- up direction now defaults to Vector3.UP and Vector2.UP
2021-06-04 11:40:36 -07:00
PouleyKetchoupp ba13d23140 KinematicBody split between new CharacterBody and PhysicsBody
PhysicsBody now has methods move_and_collide/test_move and needed
properties for these methods: safe margin, locked axes (3D only).

Moved collision_exceptions from StaticBody to PhysicsBody for 3D
(same as 2D, and conforms to documentation).

RigidBody doesn't have test_motion method anymore, it's now redundant
with PhysicsBody.test_move.
2021-06-04 11:40:36 -07:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Hugo Locurcio 4c1bbebdf3
Improve axis awareness and visibility for Position2D and Position3D 2021-06-02 21:53:50 +02:00
Rémi Verschelde 0286495f59
Merge pull request #49024 from groud/restore_tilemap_show_debug
Restore TileMap's debug collision shapes and add navigation.
2021-06-01 12:51:28 +02:00
Hugo Locurcio 8e2a7fff1d
Tweak Camera2D editor line colors for better visibility
The new color for screen drawing was chosen to be easier to distinguish
from the 2D viewport limits.

This also makes lines less opaque when the Camera2D has the Current
property enabled. The increased line width is enough to spot the
camera easily, and the increased opacity on top of that felt obnoxious.
2021-05-27 07:14:49 +02:00
Gilles Roudière 3b35733b4c Restore a way to show collsion/navigation on TileMap.
Also remove an unused function.
2021-05-25 11:51:15 +02:00
Rémi Verschelde 9bc2ba3b64
Merge pull request #48955 from Calinou/editor-tweak-property-hints
Tweak dozens of editor property hints for consistency
2021-05-25 11:44:43 +02:00
Hugo Locurcio 87f503310b
Tweak dozens of editor property hints for consistency
- Update Viewport MSAA property hints to match the currently
  exposed values.
- Add some performance hints to property hints.
2021-05-25 02:50:35 +02:00
Rémi Verschelde 5061e5620e
Merge pull request #49033 from groud/fix_deprecated_no
Fixes deprecated=no compilation option
2021-05-24 17:57:16 +02:00
Gilles Roudière f4e8c68e00 Fixes deprecated=no compilation option 2021-05-24 17:41:29 +02:00
Rémi Verschelde 9cf1d034a7
Merge pull request #48894 from reduz/gpu-particles-2d-2
Support for 2D particles to collide against SDF
2021-05-24 12:49:34 +02:00
reduz 789713b008 Support for 2D particles to collide against SDF
-Added SDF collision support for 2D particles
-Changed the SDF generation to be fully signed
2021-05-23 16:43:36 -03:00
kobewi 5605454981 Change frame_coords to Vector2i 2021-05-23 21:38:27 +02:00
Gilles Roudière d8bb53cd21 Implement scenes tiles in TileMaps 2021-05-20 13:12:03 +02:00
Rémi Verschelde c340ed6394
Merge pull request #42742 from madmiraal/fix-12215
Return RID instead of Object id in area-body_shape_entered-exited signals.
2021-05-18 20:00:48 +02:00
Aaron Franke ab674a41aa
Area: Uncap the range for gravity and change the slider hints 2021-05-18 07:17:11 -04:00
Rémi Verschelde b2fb119c53
Merge pull request #36263 from Calinou/increase-default-2d-gravity 2021-05-18 10:54:47 +02:00
Rémi Verschelde a3dd18b12e
Merge pull request #39976 from aaronfranke/tilemap-vec2i
Update TileMap to use Vector2i
2021-05-13 14:48:16 +02:00
reduz 479391ef54 Fixes missng 2D engine bits
-Mesh2D now works
-MultiMesh2D now works
-Polygon2D now works
-Added hooks for processing 2D particles
-Skeleton2D now works

2D particles still not working, but stuff needed for it is now implemented.
2021-05-11 11:21:36 -03:00
Aaron Franke 75e3f6b732
Update TileMap to use Vector2i instead of two ints 2021-05-07 16:20:02 -04:00
Gilles Roudière a3dda2df85 Rework the TileSet resource and TileMap nodes:
- Move most properties from TileMap to TileSet,
- Make TileSet more flexible, supporting more feature (several
  collision layers, etc...),
- Fusion both the TileMap and TileSet editor,
- Implement TileSetSources, and thus a new way to index tiles in the TileSet,
- Rework the TileSet and TileMap editors completely,
- Implement an editor zoom widget (and use it in several places)
2021-05-07 18:06:17 +02:00
Hugo Locurcio 4a28f7e44f
Increase the default 2D gravity to 980.0
This makes 2D RigidBody physics feel less floaty out of the box.

This closes https://github.com/godotengine/godot-proposals/issues/98.
2021-05-05 22:49:06 -04:00
kleonc f1420c7cbf TileMap::world_to_map Ensure half offset is added according to the returned value
Decide whether half offset should be added based on the value used for calculating the return value of this method.
2021-05-02 23:34:51 +02:00
Rafał Mikrut efcb097674 Prevent setting too big or too small Collision Mask and Layer 2021-04-30 17:19:04 +02:00
Rémi Verschelde 8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Rémi Verschelde 3a0cfd3d85
Merge pull request #47960 from smix8/issue_47334_navagent2d_target_reached 2021-04-27 13:34:48 +02:00
smix8 0b87cb5e3d put distance check to target into function
put distance check to target into function
2021-04-27 11:22:37 +02:00
Rémi Verschelde 1a3d60944f
Merge pull request #47485 from rafallus/fix/rigidbody-crash
Fix crash on RigidBody _direct_state_changed
2021-04-23 16:02:26 +02:00
Rémi Verschelde bd7a92ec23
Merge pull request #48030 from smix8/issue_47337_broken_navagent2d_callback 2021-04-23 10:13:44 +02:00
rafallus cfa06f0f76 Unexpose _direct_state_changed in PhysicsBody
Removed _direct_state_changed bindings
Affects 2D and 3D nodes
Callbacks now use Callable
Tests were changed accordingly
2021-04-22 23:20:58 -05:00
Marcel Admiraal 071871b787 Move collision layer and mask into CollisionObject. 2021-04-20 10:38:42 +01:00
Rémi Verschelde aa677865e3
Merge pull request #47991 from LightningAA/regroup-area-inspector-4.0
`Area[X]D`: Put physics override parameters in their own group and document that areas can be used to influence audio
2021-04-20 09:54:07 +02:00
smix8 a491071c24 Fix broken NavigationAgent2D collision avoidance callbacks
Fix broken NavigationAgent2D collision avoidance callbacks
2021-04-20 01:56:04 +02:00
Lightning_A 80b1a29c46 Put physics override parameters in their own group and document that areas can be used to influence audio 2021-04-18 21:27:06 -06:00
smix8 cd24a63da2 Fix NavigationAgent2D not emitting "target_reached" Signal reliably
Fix NavigationAgent2D not emitting "target_reached" Signal reliably
2021-04-16 22:04:02 +02:00
Nathan Franke 2a8c59c171
Use Array for node configuration warnings
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-04-11 23:25:38 -05:00
Rémi Verschelde 77264e346b
Re-allow playing AnimatedSprite2D without frames
Fixes #47578, partial revert of #47064.
2021-04-05 14:42:21 +02:00
Rafał Mikrut 504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Rémi Verschelde 6fa24729ae
Merge pull request #45571 from aaronfranke/node2d-real_t
Use real_t in 2D nodes
2021-03-23 00:10:53 +01:00
Rémi Verschelde 6608d99291
Merge pull request #47001 from madmiraal/rename-sprite_2d-region_enabled
Rename Sprite.region_enabled getter and setter methods to match properties
2021-03-20 18:36:17 +01:00
Aaron Franke 6811a45b59
Use real_t in non-physics 2D nodes 2021-03-19 13:04:45 -04:00
Rémi Verschelde 0615e55b27
Merge pull request #47064 from jmb462/fix-crash-in-uninitialized-AnimatedSprite2d-play
Fix crash on calling play() in a uninitialized AnimatedSprite2D (Fix #46013)
2021-03-17 15:21:34 +01:00
jmb462 324ab63844 Fix crash on calling play() in a uninitialized AnimatedSprite2D
When AnimatedSprite2D::play() was called before SpriteFrames has been initialized, a crach occurred (issue #46013).

Modification : An error message on null check test has been added to prevent crash.

Fix #46013.
2021-03-17 14:57:04 +01:00
Rémi Verschelde 08ca4184f4
Merge pull request #47024 from groud/navigation
Allow Navigation to be more flexible
2021-03-17 09:18:54 +01:00
Aaron Franke a94cef0ea0
Move SpriteFrames to its own file in the resources folder 2021-03-16 02:00:47 -04:00
Gilles Roudière ac7073f586 Allow Navigation to be more flexible 2021-03-15 15:58:59 +01:00
Marcel Admiraal 3dcdb84660 Rename Sprite.region_enabled getter and setter to match properties
Also renames Sprite2D.region_filter_clip property and its setter to
region_filter_clip_enabled and set_region_filter_clip_enabled.
2021-03-14 17:31:49 +00:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Gilles Roudière ba1344408f Implement Navigation layers 2021-03-10 11:23:06 +01:00
Gilles Roudière a9dc53d152 Remove Navigation2D/3D nodes, and move the navigation map to the world resource 2021-03-10 11:23:06 +01:00
Rémi Verschelde c487f1e854
Merge pull request #46643 from YeldhamDev/hide_all_the_things
Hide more options of disabled properties
2021-03-07 15:12:15 +01:00
Marcel Admiraal 38f2e32e32 Return RID instead of Object id in area-body_shape_entered-exited signals. 2021-03-06 10:48:17 +00:00
fabriceci af041adb06 add responsive arrows when the size is very small + fix a regression: missing a translation on the line 2021-03-05 22:14:06 +01:00
fabriceci 90ca587281 Highlight collision, correct the size and make the arrow a bit less thick for low-res game 2021-03-05 00:32:49 +01:00
Rémi Verschelde a3dece960f
Merge pull request #46668 from nekomatata/fix-errors-polygon-2d
Fix errors with invalid CollisionPolygon2D
2021-03-04 20:33:22 +01:00
PouleyKetchoupp 2217e477b9 Fix errors with invalid CollisionPolygon2D
Fixed internal errors when the shape is invalid and made warnings more
descriptive.
2021-03-04 10:44:37 -07:00
Michael Alexsander 4be282a269 Hide more options of disabled properties 2021-03-03 20:51:35 -03:00
Rémi Verschelde d0e62518a8
Merge pull request #46578 from nekomatata/fix-joint-remove-body-regression
Fix Joint2D/Joint3D node path reset on scene switch
2021-03-03 16:41:37 +01:00
PouleyKetchoupp 2dc5ff0caa Fix Joint2D/Joint3D node path reset on scene switch
When one of the bodies exited the tree, the corresponding node path was
reset instead of just resetting the joint from the physics server. That
was causing the node path to be reset on scene switch when one of the
bodies is under the joint in the scene tree.
2021-03-02 08:24:50 -07:00
Rémi Verschelde e871b07ed6
Merge pull request #36065 from YeldhamDev/camera2d_helper_editor_only
Make Camera2D's editor helper code only be compiled on editor builds
2021-03-02 15:06:54 +01:00
Michael Alexsander 70304f8633 Hide extra options from various nodes if they're not enabled 2021-03-02 09:25:09 -03:00
Michael Alexsander f70ccbca52 Make Camera2D's editor helper code only be compiled on editor builds 2021-03-01 14:05:45 -03:00
Kyle 821591a95b Refactored cpu_particles_2d.cpp _notification Method
Refactors the _notification method in cpu_particles_2d.cpp to use a switch statement for readability and to bring it inline with other classes like node.cpp and timer.cpp.
2021-02-28 21:59:01 -05:00
Aaron Franke 548de64742
Use a more specific type for Area2D/3D body signals 2021-02-24 00:05:54 -05:00
kleonc df49fdd189 Line2D::set_point_position Fail if passed index is out of bounds 2021-02-21 13:50:11 +01:00
Rémi Verschelde 04cb7e638c
Merge pull request #46191 from reduz/refactor-process-mode
Refactor Process Mode
2021-02-19 13:46:50 +01:00
Rémi Verschelde b84f65f13c
Merge pull request #44737 from KoBeWi/touch_shape_screen_centered_button
Fix shape_centered property in TouchScreenButton
2021-02-19 13:45:23 +01:00
reduz 083aa9b95e Refactor Process Mode
Implements https://github.com/godotengine/godot-proposals/issues/1835#issuecomment-727186192

* PauseMode is now ProcessMode, containing the following states:
	```
	PROCESS_MODE_INHERIT, // same as parent node
	PROCESS_MODE_NORMAL, // process only if not paused
	PROCESS_MODE_PAUSE_ONLY, // process only if paused
	PROCESS_MODE_ALWAYS, // process always
	PROCESS_MODE_DISABLED, // never process
	```
* NOTIFICATION_PAUSED and NOTIFICATION_UNPAUSED are received effectively when the node is paused and unpaused (not any longer when pause mode is set in SceneTree).
* Renamed some nodes that used ProcessMode/process_mode to specify a callback type to ProcessCallback to avoid clashes.
2021-02-18 20:39:55 -03:00
Rémi Verschelde a23d7480d2
Merge pull request #41644 from Eoin-ONeill-Yokai/collision_2d_shape_visualization_fix
CollisionShape2D 'Disabled' Visualization Correction
2021-02-18 23:42:02 +01:00