Commit graph

1593 commits

Author SHA1 Message Date
Rémi Verschelde ad635567b1
Merge pull request #53189 from AnilBK/use-class-specific-funcs 2021-09-29 07:40:52 +02:00
Anilforextra fc9767abb1 Use functions defined in the their classes. 2021-09-29 09:36:34 +05:45
Camille Mohr-Daurat 341b532d5e
Merge pull request #52754 from nekomatata/dynamic-body-modes
Clarify RigidDynamicBody modes
2021-09-28 17:11:17 -07:00
fabriceci dd5f01e83e Set stop on slope on by default on CharacterBody. 2021-09-28 22:31:46 +02:00
Camille Mohr-Daurat c38ef94951
Merge pull request #53174 from fabriceci/apply-delta-move-and-collide
Physic API change: apply the delta in move and collide like move and slide
2021-09-28 11:32:09 -07:00
fabriceci 32bf7c419c Sync to physics true by default for AnimatableBody 2021-09-28 16:11:17 +02:00
fabriceci 60fee25c44 Apply delta in move and collide 2021-09-28 14:53:24 +02:00
Rémi Verschelde 60988a06c2
Merge pull request #52953 from nekomatata/fix-collision-recovery-depth 2021-09-28 12:11:38 +02:00
Duroxxigar 3bcf03c40f Fixed typo in bone attachment warning 2021-09-27 18:53:56 -04:00
PouleyKetchoupp bf523a2b2a Improved logic for CharacterBody collision recovery depth
Allows 2D character controller to work without applying gravity when
touching the ground (also more safely in 3D), and collision detection
is more flexible with different safe margin values.

Character body motion changes in 2D and 3D:
-Recovery only for depth > min contact depth to help with collision
detection consistency (rest info could be lost if recovery was too much)
-Adaptive min contact depth (based on margin) instead of space parameter

Extra CharacterBody changes:
-2D: apply changes made in 3D for stop on slope and floor snap that help
fixing some jittering cases
-3D: fix minor inconsistencies in stop on slope and floor snap logic
2021-09-27 15:31:41 -07:00
LATRio 1b55d72c68 fix out of bounds crash in GPUParticle3D::_skinning_changed() 2021-09-25 23:06:32 +09:00
Hugo Locurcio b383181851
Tweak AudioStreamPlayer3D property hints for usability
This also improves the documentation for the `max_distance` property.
2021-09-25 12:24:30 +02:00
Rémi Verschelde 88b347dc27
Merge pull request #51920 from jmb462/missing-sname-macro-optimization-in-some-functions 2021-09-23 13:14:20 +02:00
Rémi Verschelde 011866edcd
Merge pull request #52956 from laws65/skeleton3d-bone-fix 2021-09-23 12:10:09 +02:00
laws65 59ff3fda7f Prevent being able to set bone's parent as itself 2021-09-23 11:30:45 +09:30
PouleyKetchoupp 9269952053 Don't override KinematicCollision reference when still in use in script
In case the reference is stored in script, create a new instance to
avoid overriding the previous values.
Otherwise, re-use the reference as before to avoid extra allocations.
2021-09-22 18:08:04 -07:00
fabriceci fd9e573ba6 Port 2D improvement to move and slide 3D
Co-authored-by: Camille Mohr-Daurat <pouleyketchoup@gmail.com>
2021-09-22 00:14:04 +02:00
Anilforextra 90908cd67d Add Get Center Method for Rect2/Rect2i and AABB. 2021-09-21 21:14:17 +05:45
Rémi Verschelde 43cc6dd479
Merge pull request #52774 from Calinou/audiostreamplayer3d-remove-out-of-range 2021-09-17 21:56:59 +02:00
Hugo Locurcio 973f52b784
Remove unused out_of_range_mode property from AudioStreamPlayer3D
The `out_of_range_mode` property is no longer used since audio mixing
was moved out of the various AudioStreamPlayer nodes.
2021-09-17 20:18:38 +02:00
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
Wilson E. Alvarez f3a564f9a5
Rename Listener2D/Listener3D to AudioListener2D/AudioListener3D 2021-09-16 17:51:51 -04: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
Hugo Locurcio 05697ee848
Display a editor gizmo icon for Listener3D
The icon was present in `editor/icons/`, but it was never implemented
in the editor gizmos code.

This also removes some unused gizmo drawing code (overridden methods
that are no longer called anywhere).
2021-09-16 10:56:45 +02:00
Rémi Verschelde e13d8eda1b
Merge pull request #52266 from AndreaCatania/coll 2021-09-14 14:34:22 +02:00
Haoyu Qiu 88e3ba83f0 Make sure IK target is inside tree before using its transform 2021-09-14 17:46:39 +08:00
Juan Linietsky 25291a5b03
Merge pull request #52462 from TokageItLab/fixed-regression-of-skinning
Fixed regression of skinning with skeleton
2021-09-08 10:07:46 -03:00
AndreaCatania e3a06c3a9e Improve collision generation usability in the new 3D scene import workflow.
With this PR it's possible to add a collision during the Mesh import, directly in editor.
To generate the shape is possible to chose between the following options:
- Decompose Convex: The Mesh is decomposed in one or many Convex Shapes (Using the VHACD library).
- Simple Convex: Is generated a convex shape that enclose the entire mesh.
- Trimesh: Generate a trimesh shape using the Mesh faces.
- Box: Add a primitive box shape, where you can tweak the `size`, `position`, `rotation`.
- Sphere: Add a primitive sphere shape, where you can tweak the `radius`, `position`, `rotation`.
- Cylinder: Add a primitive cylinder shape, where you can tweak the `height`, `radius`, `position`, `rotation`.
- Capsule: Add a primitive capsule shape, where you can tweak the `height`, `radius`, `position`, `rotation`.

It's also possible to chose the generated body, so you can create:
- Rigid Body
- Static Body
- Area
2021-09-08 08:12:51 +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
Silc 'Tokage' Renew 48aa2d5494 Fixed regression of skinning with skeleton 2021-09-07 23:59:29 +09: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
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
Camille Mohr-Daurat a9fcbb1001
Merge pull request #51364 from bengtsts/master
Expose soft body pin methods to GDScript
2021-08-31 07:41:34 -07:00
fabriceci f9d548627d delta time as double 2021-08-31 14:32:56 +02:00
Bengt Söderström 08a80962cf Expose soft body pin methods to GDScript 2021-08-30 20:07:14 +02:00
Juan Linietsky 6dab6e4136
Revert " Improve collision generation usability in the new 3D scene import workflow." 2021-08-30 11:30:36 -03:00
Camille Mohr-Daurat b60a51f023
Merge pull request #51985 from AndreaCatania/coll
Improve collision generation usability in the new 3D scene import workflow.
2021-08-30 07:25:51 -07: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
Max Hilbrunner e0355d5db6
Merge pull request #43573 from lewiji/master
sprite_3d.cpp: return _is_playing() from public is_playing() function
2021-08-28 19:55:54 +02:00
AndreaCatania 2d2d24a538 Improve collision generation usability in the new 3D scene import workflow.
With this PR it's possible to add a collision during the Mesh import, directly in editor.
To generate the shape is possible to chose between the following options:
- Decompose Convex: The Mesh is decomposed in one or many Convex Shapes (Using the VHACD library).
- Simple Convex: Is generated a convex shape that enclose the entire mesh.
- Trimesh: Generate a trimesh shape using the Mesh faces.
- Box: Add a primitive box shape, where you can tweak the `size`, `position`, `rotation`.
- Sphere: Add a primitive sphere shape, where you can tweak the `radius`, `position`, `rotation`.
- Cylinder: Add a primitive cylinder shape, where you can tweak the `height`, `radius`, `position`, `rotation`.
- Capsule: Add a primitive capsule shape, where you can tweak the `height`, `radius`, `position`, `rotation`.

It's also possible to chose the generated body, so you can create:
- Rigid Body.
- Static Body.
- Area.
2021-08-28 08:34:15 +02: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
PouleyKetchoupp bae06008c8 Port recent move_and_slide fixes to 3D
Improves stop on slopes, sliding on walls and gravity handling by
porting existing changes from CharacterBody2D to CharacterBody3D.

Co-authored-by: fabriceci <fabricecipolla@gmail.com>
2021-08-24 11:30:01 -07:00
Camille Mohr-Daurat 770a1d00a3
Merge pull request #51751 from jeffrey-cochran/windforce
Created an area-specific wind force that interacts with soft bodies
2021-08-23 16:48:19 -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
Jeffrey Cochran e806397196 Enabled area-specific wind forces 2021-08-23 17:00:50 -04: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
jmb462 54de7114c5 Add missing SNAME macro optimization for StringName in some functions 2021-08-20 14:50:24 +02:00
jfons 55e7832d7b Improvements to SpotLight3D and OmniLight3D's shadows
OmniLight3D:
* Fixed lack of precision in cube map mode by scaling the projection's
  znear.
* Fixed aliasing issues by making the paraboloids use two square regions instead of two half
  squares.
* Fixed shadowmap atlas bleeding by adding padding.
* Fixed sihadow blur's inconsistent radius and unclamped sampling.

SpotLight3D:
* Fixed lack of precision by scaling the projection's znear.
* Fixed normal biasing.

Both:
* Tweaked biasing to make sure it works out of the box in most situations.
2021-08-19 13:46:51 +02:00
Rémi Verschelde b463ac747a
Merge pull request #51798 from nekomatata/fix-skeleton-child-bones 2021-08-18 00:56:06 +02:00
PouleyKetchoupp 91fdf7c15b Fix Skeleton3D regression when bones are not sorted from root to leaves
Tentative fix for missing bones when bones are not sorted as expected.
For example, if the root comes last, all child bones are removed and
the skeleton ends up with just the root.
2021-08-17 08:31:38 -07:00
PouleyKetchoupp 2084bb5eb9 Fix 3D character snap on moving platforms
Applying the platform velocity when leaving the platform floor should be
done after snapping to keep things consistent, like it's done in 2D.
2021-08-17 07:18:22 -07:00
Rémi Verschelde 43440228db
Merge pull request #51645 from fabriceci/improve-physics-api
API improvement on the physics (CharacterBody and related classes)
2021-08-16 17:05:08 +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
TwistedTwigleg 5ffed49907 New and improved IK system for Skeleton3D
This PR and commit adds a new IK system for 3D with the Skeleton3D node
that adds several new IK solvers, as well as additional changes and functionality
for making bone manipulation in Godot easier.

This work was sponsored by GSoC 2020 and TwistedTwigleg

Full list of changes:
* Adds a SkeletonModification3D resource
  * This resource is the base where all IK code is written and executed
* Adds a SkeletonModificationStack3D resource
  * This node oversees the execution of the modifications and acts as a bridge of sorts for the modifications to the Skeleton3D node
* Adds SkeletonModification3D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in it's own file
* Several changes to Skeletons, listed below:
  * Added local_pose_override, which acts just like global_pose_override but keeps bone-child relationships intract
    * So if you move a bone using local_pose_override, all of the bones that are children will also be moved. This is different than global_pose_override, which only affects the individual bone
  * Internally bones keep track of their children. This removes the need of a processing list, makes it possible to update just a few select bones at a time, and makes it easier to traverse down the bone chain
  * Additional functions added for converting from world transform to global poses, global poses to local poses, and all the same changes but backwards (local to global, global to world). This makes it much easier to work with bone transforms without needing to think too much about how to convert them.
  * New signal added, bone_pose_changed, that can be used to tell if a specific bone changed its transform. Needed for BoneAttachment3D
  * Added functions for getting the forward position of a bone
* BoneAttachment3D node refactored heavily
  * BoneAttachment3D node is now completely standalone in its functionality.
    * This makes the code easier and less interconnected, as well as allowing them to function properly without being direct children of Skeleton3D nodes
  * BoneAttachment3D now can be set either using the index or the bone name.
  * BoneAttachment3D nodes can now set the bone transform instead of just following it. This is disabled by default for compatibility
  * BoneAttachment3D now shows a warning when not configured correctly
* Added rotate_to_align function in Basis
* Added class reference documentation for all changes
2021-08-14 15:57:00 -04:00
Rémi Verschelde b9b6102b91
Merge pull request #51660 from AnilBK/use-short-functions
Use get_global_* functions instead of using transforms.
2021-08-14 12:17:53 +02:00
Rémi Verschelde a96c96ca72
Merge pull request #50147 from aaronfranke/disable-node3d
Disable Node3D when compiling without 3D and fix disable_3d option
2021-08-14 11:59:06 +02:00
Anilforextra c390f0515d Use get_global_* functions instead of using transforms. 2021-08-14 14:01:57 +05:45
Rémi Verschelde e499758a77
Merge pull request #51025 from reduz/fix-directional-shadow-bias
Fix directional shadow bias
2021-08-13 16:45:49 +02:00
Aaron Franke 7094ccfbe9
Disable Node3D when compiling without 3D and fix disable_3d option 2021-08-13 08:59:48 -05:00
Rémi Verschelde 85e315d6e8
Merge pull request #51607 from aaronfranke/includes
Fix some unnecessary includes
2021-08-13 14:38:56 +02:00
Aaron Franke eb4902a455
Fix some unnecessary includes 2021-08-13 00:27:38 -05:00
Hugo Locurcio 7612cff432
Use the Unicode multiplication symbol where relevant 2021-08-12 21:45:33 +02:00
Rémi Verschelde 56ac302dc4
Merge pull request #51580 from aaronfranke/particles-real-double
Use real_t and double where appropriate in Particles
2021-08-12 20:51:21 +02:00
Rémi Verschelde 1a9c8aaba9
Merge pull request #51558 from fabriceci/fix-move-and-slide-regression-multiple-collision-4
Fix move and slide regression by allowing multiple collision direction
2021-08-12 20:37:30 +02: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
Morris Tabor d7e059ff84 Fix CPU Particles spread
Same as https://github.com/godotengine/godot/pull/51565 but ported to master.
2021-08-12 14:36:30 +02:00
fabriceci ce52d3e7b5 Fix move and slide regression by allowing multiple collision direction 2021-08-12 12:42:17 +02:00
Rémi Verschelde 80dec1948a
Merge pull request #41956 from Calinou/rename-engine-iterations-per-second
Rename `iterations_per_second` to `physics_ticks_per_second`
2021-08-11 08:05:33 +02:00
Hugo Locurcio 937c1a716c
Rename iterations_per_second to physics_ticks_per_second
This makes it clearer that this property is only about physics FPS,
not rendering FPS.

The `physics_fps` project setting was also renamed to
`physics_ticks_per_second` for consistency.
2021-08-11 02:37:02 +02:00
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
Aaron Franke 339687e04f
Organize methods in Viewport and explicitly name 3D methods with 3D 2021-08-10 09:10:34 -05: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
Rémi Verschelde 16d73fefdb
Merge pull request #50682 from aaronfranke/basis-looking-at
Move code for looking_at to Basis
2021-08-10 11:28:12 +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
Rémi Verschelde dc20830348
Merge pull request #45568 from aaronfranke/node3d-real_t
Use real_t in 3D nodes
2021-08-09 21:01:29 +02:00
Raul Santos 18f7acf611 Fix Path3D initial forward calculation 2021-08-07 12:39:34 +02:00
PouleyKetchoupp 7d0a28f875 Fix inverted condition in CharacterBody2D/3D set_max_slides 2021-08-03 19:24:46 -07:00
Aaron Franke 7cec3c2b95
Use real_t in 3D nodes 2021-08-03 11:16:51 -05:00
Rémi Verschelde 0f8cba285b
Merge pull request #50986 from raulsntos/fix-path-3d-end 2021-08-03 09:31:22 +02:00
Aaron Franke 9f3ae0adcd
Move code for looking_at to Basis 2021-08-01 12:49:02 -05:00
reduz 55d357b1eb Fix directional shadow bias
* Simplified code a lot, bias based on normalized cascade size.
* Lets scale cascades, max distance, etc. without creating acne.
* Fixed normal biasing in directional shadows.

I removed normal biasing in both omni and spot shadows, since the technique can't be easily implemented there.
Will need to be replaced by something else.
2021-07-29 13:51:32 -03:00
Raul Santos e23f6a5bba Fix forward calculation in PathFollow3D for the position at the end of the curve 2021-07-28 22:10:36 +02:00
Hugo Locurcio 48fc5b2480
Add node configuration warning for GeometryInstance3D distance 2021-07-28 19:33:14 +02:00
Haoyu Qiu 448295cd51 Add check to internal methods to prevent crash 2021-07-27 12:26:13 +08: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
Rémi Verschelde 4c3d5850de
Merge pull request #50748 from JFonS/gizmo_rework
Node3D gizmo improvements
2021-07-23 21:55:16 +02:00
jfons cfb555a081 Node3D gizmo improvements
* Clean-up of node_3d_editor_plugin.{h,cpp}: removed unused code, fixed some bugs.
* Moved node_3d_editor_gizmos.{h,cpp} to editor/plugins.
* Added support for multiple gizmos per node. This means custom gizmos will no longer override the built-in ones and that multiple gizmos can be used in more complex nodes.
* Added support for handle IDs. When adding handles to a gizmo, an ID can be specified for each one, making it easier to work with gizmos that have a variable number of handles.
* Added support for subgizmos, selectable elements that can be transformed without needing a node of their own. By overriding _subgizmo_intersect_frustum() and/or _subgizmo_intersect_ray() gizmos can define which subgizmos should be selected on a region or click selection. Subgizmo transformations are applied using get/set/commit virtual methods, similar to how handles work.
2021-07-23 21:01:10 +02:00
Rémi Verschelde d42f6f4718
Merge pull request #50370 from QbieShay/circle-emitter-particle
Ring emitter for 4.0
2021-07-21 16:50:26 +02:00
Aaron Franke 78b0a7da03
Use is_equal_approx in more places 2021-07-21 00:32:37 -04: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
Rémi Verschelde db010bd71d
Merge pull request #50604 from aaronfranke/float-array-cast
Explicitly cast real_t to float when creating a float array
2021-07-19 22:47:57 +02:00
Aaron Franke 09f0596eb2
Explicitly cast to float when creating a float array 2021-07-19 01:21:22 -04: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
PouleyKetchoupp 7f92127959 Support for 3D sync to physics
Same implementation as in 2D.
2021-07-15 10:15:13 -07: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
Rémi Verschelde bc6ea71771
Merge pull request #50063 from nekomatata/more-accurate-move-and-slide
Make move_and_slide collision detection more accurate
2021-07-13 20:41:09 +02:00
Rémi Verschelde 65486cd15e
Merge pull request #50401 from Calinou/decal-add-node-configuration-warnings
Add node configuration warnings for the Decal node
2021-07-13 08:13:21 +02:00
Hugo Locurcio 1bbdc5cc65
Add node configuration warnings for the Decal node 2021-07-13 01:57:59 +02:00
QbieShay 9058367d14 This commits adds a new emitter type for particles material
and 3D CPU particles. The new emitter is called "ring"
and it can emit either in a ring or cylinder fashion.
This adds the following properties for the emitter:
1. emission_ring_axis: the axis along which the ring/cylinder
    will be constructed
2. emission_ring_radius: outer radius of the ring/cylinder
3. emission_ring_inner_radius: inner radius of the cylinder.
    when set to zero, particles will emit in the full volume.
4. emission_ring_height: height of the ring/cylinder emitter.
2021-07-11 17:30:47 +02:00
PouleyKetchoupp 1de995ae99 Options to clean/simplify convex hull generated from mesh
Clean: remove duplicate and interior vertices (uses Bullet algorithm)
Simplify: modify the geometry for further simplification (uses VHACD
algorithm)

In the editor, single convex hull now uses the clean option.
Added a new editor entry to create a simplified convex hull, can be
useful for creating convex hull from highly tessellated triangle meshes.
2021-07-07 12:14:12 -07:00
Rémi Verschelde 48a5226829
Merge pull request #50193 from reduz/fix-command-queue-crash
Fix Command Queue Crash
2021-07-07 16:36:13 +02:00
Rémi Verschelde f62da984af
Merge pull request #50214 from Calinou/occluderinstance3d-add-node-configuration-warnings
Add node configuration warnings to OccluderInstance3D
2021-07-07 16:04:02 +02:00
reduz d41e3f9aeb Fix Command Queue Crash
* No longer allow sending an object (texture) to the server as material parameter
* Keep a parameter cache locally in ShaderMaterial
2021-07-07 10:57:56 -03:00
Hugo Locurcio 8cc147076c
Add node configuration warnings to OccluderInstance3D 2021-07-07 13:59:52 +02:00
Hugo Locurcio 8f7e1b53ff
Allow using ORMMaterial3D by using BaseMaterial3D as a resource hint
Previously, only StandardMaterial3D could be defined as an alternative
to ShaderMaterial.

This also reorders the CanvasItemMaterial property hints to follow
alphabetical order (which is enforced by the inspector).
2021-07-04 17:49:36 +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
Hugo Locurcio 5370f4876e
Remove leftovers from the DirectionalLight3D Optimized shadow depth range
The Optimized shadow depth range was removed in late 2020 in favor
of the Stable shadow depth range, but it still had a (broken) property
that allowed to enable it.
2021-07-02 20:32:43 +02: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
Rémi Verschelde ad8a2b3d52
Merge pull request #50040 from reduz/fix-renderingserver-bindings
Clean up RenderingServer and its bindings
2021-07-01 15:17:33 +02:00
reduz 37776b2867 Clean up RenderingServer and its bindings
* Rewrote bindings for RenderingServer.
* They are now all up to date.
* Several unused methods and deprecated features were cleaned up.
2021-07-01 09:07:36 -03:00
reduz 9ad0c6cde7 Import mesh colors in 8BPP.
* Colors were imported as 16BPP (half float)
* Far most common use cases only require 8BPP
* If you need higher data precision, use a custom array, which are supported now.

**WARNING**: 3D Scenes imported in 4.0 no longer compatible with this new format. You need to re-import them (erase them from .godot/import)
2021-06-30 23:33:25 -03: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 270f9d4c88
Merge pull request #50014 from reduz/remove-immediate
Deprecate ImmediateGeometry
2021-06-30 20:18:59 +02:00
reduz 85cf99f28e Deprecate ImmediateGeometry
* Removed entirely from RenderingServer.
* Replaced by ImmediateMesh resource.
* ImmediateMesh replaces ImmediateGeometry, but could use more optimization in the future.
* Sprite3D and AnimatedSprite3D work again, ported from Godot 3.x (though a lot of work was needed to adapt them to Godot 4).
* RootMotionView works again.
* Polygon3D editor works again.
2021-06-30 14:14:41 -03: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
Hugo Locurcio f28b55b551
Increase the default ReflectionProbe extents to Vector3(10, 10, 10)
On top of having a more realistic size out of the box, this matches
the default VoxelGI extents for better usability.
2021-06-27 16:46:03 +02:00
Lightning_A 899e5f8685 Rename is_a_parent_of() to is_ancestor_of() 2021-06-21 08:39:28 -06:00
Aaron Franke 0ce49800ac
Use mouse and joypad enums instead of plain integers
Also MIDIMessage
2021-06-20 11:54:24 -04:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Hugo Locurcio e98f5a53ad
Use double-sided material for RayCast3D
This makes RayCast3Ds visible if the camera is fully inside one
(e.g. a RayCast3d parented to the current Camera3D).
2021-06-19 05:05:58 +02: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 6e98c4cd50 Refactor VisibilityNotifier3D
* This is the 3D counterpart to #49632
* Implemented a bit different as 3D works using instancing

After merged, both 2D and 3D classes will most likely be renamed in a separate PR to DisplayNotifier2D/3D.
2021-06-16 18:50:39 -03:00