Commit graph

27 commits

Author SHA1 Message Date
Lily Garcia 8ee6264cc9 Implement collision impulse in Godot Physics 3D 2023-01-07 22:34:28 -05:00
Aaron Franke a3e52925bf
Fix default values on virtual classes causing errors in projects 2022-11-09 01:59:53 -06:00
Rémi Verschelde 56e1520f82
Merge pull request #68098 from compmstr/apply-torque-inertia-note
Add note about inertia being required for apply_torque on various Node types
2022-11-08 10:48:33 +01:00
Aaron Franke 3dc9474355
Fix default values not showing up on virtual classes 2022-11-06 15:05:36 -06:00
Corey Williams f19de2ae4c Add note about inertia being required for apply_torque on various Nodes
- RigidBody2D
  - PhysicsDirectBodyState2D
  - RigidBody3D
  - PhysicsDirectBodyState3D
2022-11-06 10:16:56 -05:00
Mikael Hermansson 8dc15aac38 Bind PhysicsDirectBodyState3D::get_inverse_inertia_tensor 2022-10-05 17:18:49 +02:00
fabriceci f8cc88fab3 Restore RigidBody2/3D, SoftBody names in physics 2022-08-26 12:26:25 +02:00
Andy Maloney 1df86ecea5 [doc] Use "param" instead of "code" to refer to parameters (4) 2022-08-11 13:52:19 -04:00
Yuri Sizov c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Hugo Locurcio b68dd2e189
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
Hugo Locurcio 5d81742dc8
Document RigidBody2D/3D and particles' angular velocity units 2021-12-11 17:38:55 +01:00
PouleyKetchoupp 940f3fde5c Improve RigidDynamicBody force and torque API
Makes the API for forces and impulses more flexible, easier to
understand and harmonized between 2D and 3D.

Rigid bodies now have 3 sets of methods for forces and impulses:
-apply_impulse() for impulses (one-shot and time independent)
-apply_force() for forces (time dependent) applied for the current step
-add_constant_force() for forces that keeps being applied each step

Also updated the documentation to clarify the different methods and
parameters in rigid body nodes, body direct state and physics servers.
2021-12-10 15:55:40 -07:00
Rémi Verschelde 6c1bd4d227
Replace Godot docs URL with $DOCS_URL in XML class reference 2021-11-15 13:02:21 +01:00
PouleyKetchoupp fc8c766ef9 Expose local center of mass in physics servers
Center of mass in body's local space is more useful than the transformed
one in some cases, like drawing its position for debug.

It's especially useful to get the generated local center of mass when
in auto mode (by default).

Physics Server BODY_PARAM_CENTER_OF_MASS:
Now always returns the local center of mass, instead of setting a local
center of mass and getting a transformed one.
This causes compatibility breaking, but it makes more sense for the
parameter to be consistent between getter and setter.

Direct Body State:
There are now two properties, because both of them can be useful in
different situations.
center_of_mass: relative position in global coordinates (same as before)
center_of_mass_local: position in local coordinates
2021-11-08 16:17:57 -07:00
Aaron Franke d54f2ad7ca
Don't generate empty doc sections and reduce code duplication 2021-09-20 20:59:33 -05: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
Max Hilbrunner 7413dcb4f4
Merge pull request #52306 from CinchBlue/master
Add "Physics intro" docs link for State classes
2021-09-09 04:02:36 +02: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
Austin Tasato ce8eb09a25 Add "Physics intro" docs link for State classes 2021-09-01 06:03:03 -07: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
Rémi Verschelde 7adf4cc9b5
doc: Use self-closing tags for return and argument
For the time being we don't support writing a description for those, preferring
having all details in the method's description.

Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.
2021-07-30 15:29:52 +02:00
Michael Alexsander Silva Dias 0ff4095b36 Better format arguments in variant parser 2021-06-18 00:06:40 -03: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
Aaron Franke 0ac4051c00
Update documentation for Transform3D 2021-06-03 07:30:01 -04:00
Aaron Franke ba27deef06
Refactor physics force and impulse code 2020-06-02 23:18:59 -04:00
Rémi Verschelde eaaee63b62 doc: Update classref with node renames
A few extra renames for classes which were missed in last week's PRs.
2020-03-30 18:23:02 +02:00
Renamed from doc/classes/PhysicsDirectBodyState.xml (Browse further)