summaryrefslogtreecommitdiff
path: root/scene/3d/physics_body_3d.cpp
AgeCommit message (Collapse)Author
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-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-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>
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-06-18Merge pull request #49475 from nekomatata/kinematic-collision-ridRémi Verschelde
Expose collider RID in 2D/3D kinematic collision
2021-06-17Add PROPERTY_USAGE_NONE and use itAaron Franke
2021-06-09Expose collider RID in 2D/3D kinematic collisionPouleyKetchoupp
Can be useful to access the colliding body information for bodies created with the physics server directly.
2021-06-08Use degrees instead of rad for floor_max_angle property in CharacterBodyPouleyKetchoupp
2021-06-04Linear velocity cleanupPouleyKetchoupp
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-04Safe margin cleanupPouleyKetchoupp
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-04Support for kinematic_motion in StaticBodyPouleyKetchoupp
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-04More explanatory names for RigidBody modesPouleyKetchoupp
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-04Properties for move_and_slide and remove move_and_slide_with_snapPouleyKetchoupp
- 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-04KinematicBody split between new CharacterBody and PhysicsBodyPouleyKetchoupp
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-03Rename Variant TRANSFORM to TRANSFORM3DAaron Franke
Also _transform to _transform3d
2021-06-03Rename Transform to Transform3D in coreAaron Franke
2021-05-20Merge pull request #48860 from JohnM666/fix-basis-variant-initializationRémi Verschelde
Fix RigidBody3D.get_inverse_inertia_tensor() crash
2021-05-20Fix #46282 Executing RigidBody3D.get_inverse_inertia_tensor() crashes GodotJohnM666
2021-05-19Fix ragdoll simulation when parent was readded to sceneHaoyu Qiu
2021-05-18Merge pull request #42742 from madmiraal/fix-12215Rémi Verschelde
Return RID instead of Object id in area-body_shape_entered-exited signals.
2021-05-05Create CollisionObject3D debug shapes using RStrollodel
2021-04-22Unexpose _direct_state_changed in PhysicsBodyrafallus
Removed _direct_state_changed bindings Affects 2D and 3D nodes Callbacks now use Callable Tests were changed accordingly
2021-04-20Move collision layer and mask into CollisionObject.Marcel Admiraal
2021-04-11Use Array for node configuration warningsNathan Franke
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
2021-03-06Return RID instead of Object id in area-body_shape_entered-exited signals.Marcel Admiraal
2021-02-10Removed _change_notifyreduz
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap. -For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed() -Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-10Make Servers truly Thread Safereduz
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread). -RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault. -Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory). -3D physics server changed to be made multithread friendly. -Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads. -Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-07Initialize class variables with default values in scene/ [1/2]Rafał Mikrut
2021-02-01Merge pull request #37547 from aaronfranke/tauRémi Verschelde
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-01-29Use real_t in physics nodesAaron Franke
2021-01-19Fixed 6DOF set/get check for the path starting with joint_constraintsHipsterPenguin
New code checks whether or not property has joint_constraints as the first part of its path.
2021-01-09Use Math_TAU and deg2rad/rad2deg in more places and optimize codeAaron Franke
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-22Fix joint RID not being passed to _set in PhysicalBoneDavid Hoppenbrouwers
Also remove default RID() argument from JointData._set()
2020-11-27Remove RigidBody weight propertyMarcel Admiraal
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-10-18Refactor MethodBind to use variadic templatesreduz
Removed make_binders and the old style generated binders.
2020-10-13Remove old RigidBody layers property and methods.Marcel Admiraal
2020-10-02Merge pull request #42451 from Duroxxigar/rename-toplevelRémi Verschelde
Renamed toplevel to be top_level
2020-10-01Merge pull request #38743 from arrowinaknee/node-config-warningsRémi Verschelde
Update all get_configuration_warning() to retrieve warnings from the parent
2020-10-01Renamed toplevel to be top_levelDuroxxigar
2020-07-21Add Method get_inverse_inertia_tensorYerik
2020-07-14Properly pass safe margin on initialization.Juan Linietsky
Fixes jitter.
2020-07-02Merge pull request #37350 from aaronfranke/force-impulseRémi Verschelde
Refactor physics force and impulse code to use (force, position) order