summaryrefslogtreecommitdiff
path: root/scene/2d
AgeCommit message (Collapse)Author
2021-08-16Correct jitter and clean codefabriceci
2021-08-15API improvement on physics, mainly CharacterBodyfabriceci
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-14Use get_global_* functions instead of using transforms.Anilforextra
2021-08-13Fix some unnecessary includesAaron Franke
2021-08-12Use real_t and double where appropriate in ParticlesAaron Franke
2021-08-12Merge pull request #51532 from nekomatata/layer-mask-accessorsRémi Verschelde
Uniformize layer names, script methods and documentation
2021-08-12Uniformize layer names, script methods and documentationPouleyKetchoupp
- 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-12Merge pull request #51568 from AnilBK/remove-swapRémi Verschelde
Remove unused swap template.
2021-08-12Merge pull request #50363 from JestemStefan/node2D_zero_scale_det_errorRémi Verschelde
Limit scale of `Node2D` to EPSILON (0.00001) to prevent `det==0` error
2021-08-12Remove unused swap template.Anilforextra
2021-08-10Remove infinite inertia and ray shapes from CharacterBodyPouleyKetchoupp
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-10Add properties to CharacterBody for more move_and_slide optionsfabriceci
2021-08-10Merge pull request #51457 from nekomatata/moving-platforms-3dRémi Verschelde
Fix 3D moving platform logic
2021-08-09Fix 3D moving platform logicPouleyKetchoupp
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-09Some work on double supportAaron Franke
2021-08-09Merge pull request #51446 from nekomatata/fix-moving-platform-rotationRémi Verschelde
Fix applied rotation from moving platforms in move_and_slide
2021-08-09Fix applied rotation from moving platforms in move_and_slidePouleyKetchoupp
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-09Use doubles for time in many other placesAaron Franke
2021-08-05Fix get_used_rect() calculationkobewi
2021-08-03Fix inverted condition in CharacterBody2D/3D set_max_slidesPouleyKetchoupp
2021-08-02Implements TileMap layers and move TileSetPlugins's functions to the TileMap ↵Gilles Roudière
node instead
2021-07-30Merge pull request #50935 from Vitika9/50807Rémi Verschelde
2021-07-27Merge pull request #50905 from fabriceci/fix-multiple-direction-collisionRémi Verschelde
Allow multiple collision direction at the same time
2021-07-27Fixed Camera2D's reset_smoothing() does not work as describedvitika9
2021-07-27Add check to internal methods to prevent crashHaoyu Qiu
2021-07-26Allow to have multiple collision direction at the same timefabriceci
2021-07-25Use const references where possible for List range iteratorsRémi Verschelde
2021-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-07-21Implement atlas merging and tile proxiesGilles Roudière
2021-07-21Import old tiles in SINGLE_TILE mode as atlasesGilles Roudière
2021-07-20Merge pull request #38317 from verdog/get-cam-2d-4.0Rémi Verschelde
add viewport.get_camera_2d()
2021-07-18Optimize StringName usagereduz
* 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-16Merge pull request #47395 from sygi/shape_idx_collisionHugo Locurcio
Add shape_idx to CollisionObject2D mouse_entered signal
2021-07-15Move sync to physics to StaticBody2DPouleyKetchoupp
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-15Fixing 2D moving platform logicfabriceci
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-14Merge pull request #49348 from Geometror/fix-particles-hidden-basecolorRémi Verschelde
Fix color properties of particle nodes/material
2021-07-12Limit scale of node2D to EPSILON 0.00001 to prevent det==0 bugJestemStefan
2021-07-04Fix color properties of particle nodes/materialHendrik Brucker
2021-07-03add viewport.get_camera_2d()Josh Chandler
* 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-02Add mouse_shape_entered and mouse_shape_exited signals to CollisionObject2D.sygi
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-07-01Make move_and_slide collision detection more accuratePouleyKetchoupp
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-01Use PROPERTY_USAGE_NONE instead of 0 for no property usageAaron Franke
Also use const more often.
2021-06-30Enable Camera2D smoothing on limit changeEric
2021-06-30Merge pull request #49834 from nekomatata/physics-disable-modesRémi Verschelde
Add support for controlling physics nodes' behavior when disabled
2021-06-30Merge pull request #50009 from reduz/fix-suffixes-and-degreesRémi Verschelde
Fix editor suffixes and degrees conversion
2021-06-30Add support for controlling physics nodes' behavior when disabledPouleyKetchoupp
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-30Fix editor suffixes and degrees conversionreduz
* 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-30Merge pull request #49901 from nekomatata/move-and-collide-fix-slideRémi Verschelde
Fix move_and_collide causing sliding on slopes
2021-06-29Merge pull request #49719 from LightningAA/rename-node-is-ancestor-ofRémi Verschelde
Rename `is_a_parent_of()` to `is_ancestor_of()`
2021-06-28Fix move_and_collide causing sliding on slopesPouleyKetchoupp
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>