summaryrefslogtreecommitdiff
path: root/servers/physics_server_3d.cpp
AgeCommit message (Collapse)Author
2021-09-06Proper support for custom mass properties in 2D/3D physics bodiesPouleyKetchoupp
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-08-30Harmonize default value for collision mask in ray/shape queriesPouleyKetchoupp
The default mask for queries was 0, 0x7FFFFFFF or 0xFFFFFFFF depending on the cases. Now always using 0xFFFFFFFF (in the form of UINT32_MAX to make it clear) in order to use all layers by default.
2021-08-24Rename RayShape to SeparationRayShapePouleyKetchoupp
Makes it clearer that it's used for special cases when picking a collision shape.
2021-08-24Fix CharacterBody motion with RayShapePouleyKetchoupp
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-24Restore RayShape as a regular shape typePouleyKetchoupp
Partial revert from previously removing ray shapes completely, added back as a shape type but without the specific character controller code.
2021-08-23Enabled area-specific wind forcesJeffrey Cochran
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-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-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-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-07-10Add a method to set the number of physics solver iterations in 3DHugo Locurcio
This is only for GodotPhysics, and adds a 3D counterpart to the 2D method that was recently added.
2021-07-05Remove unused PhysicsShapeQueryResult3D & PhysicsShapeQueryResult2DPouleyKetchoupp
2021-07-02Expose body_test_motion in 3D physics serverPouleyKetchoupp
Results are exposed through PhysicsTestMotionResult3D, the same way it's done for 2D. Also cleaned a few things in the 2D version.
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-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-03Rename Variant TRANSFORM to TRANSFORM3DAaron Franke
Also _transform to _transform3d
2021-06-03Rename Transform to Transform3D in coreAaron Franke
2021-04-30Prevent setting too big or too small Collision Mask and LayerRafał Mikrut
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-03-18SoftBody support in GodotPhysics 3DPouleyKetchoupp
- Fixed SoftBody surface update with new rendering system - Added GodotPhysics implementation for SoftBody - Added support to get SoftBody rid to interact with the physics server - Added support to get SoftBody bounds from the physics server - Removed support for unused get_vertex_position and get_point_offset from the physics server - Removed SoftBody properties that are unused in both Bullet and GodotPhysics (angular and volume stiffness, pose matching) - Added RenderingServerHandler interface to PhysicsServer3D so the physics servers don't need to reference the class from SoftBody node directly
2021-02-19doc: Sync classref with current sourceRémi Verschelde
And fix various bogus bindings following previous PRs.
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-01-28Use real_t in physics codeAaron Franke
2021-01-27Correctly expose transform as 3D transformWinston Yallow
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-11-09Variant: Rename Type::_RID to Type::RIDRémi Verschelde
The underscore prefix was used to avoid the conflict between the `RID` class name and the matching enum value in `Variant::Type`. This can be fixed differently by prefixing uses of the `RID` class in `Variant` with the scope resolution operator, as done already for `AABB`.
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-07-02Merge pull request #37350 from aaronfranke/force-impulseRémi Verschelde
Refactor physics force and impulse code to use (force, position) order
2020-06-26Expose shape property for shape query parameters classesAndrii Doroshenko (Xrayez)
Co-authored-by: PouleyKetchoupp <pouleyketchoup@gmail.com>
2020-06-21Check for motion in cast_motion() before doing Bullet convexSweepTest().Marcel Admiraal
Also ensure that default closest_safe and closest_unsafe values are defined in cast_motion() and before cast_motion() is called.
2020-06-02Refactor physics force and impulse codeAaron Franke
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-28More server renames for consistency after #37361Rémi Verschelde
2020-03-27Renaming of servers for coherency.Juan Linietsky
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.