Commit graph

1318 commits

Author SHA1 Message Date
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