Commit graph

124 commits

Author SHA1 Message Date
qarmin 856a8226a5 Small fixes, mostly dupicated code 2019-04-08 11:03:37 +02:00
Kanabenki 3f64215a43 Add missing check for 2d physics bounce and friction setters
The override check was already present for 3d physics but missing for 2d
2019-03-18 15:30:26 +01:00
Juan Linietsky 4f041d3afa Specifically error when users try to use sync to physics and move and slide, closes #26545 2019-03-04 09:53:02 -03:00
Juan Linietsky 9dfe3b6d9e Ensure move and slide snap respects stop on slope, fixes #26180 2019-02-23 10:24:21 -03:00
Juan Linietsky 87b303aa95 Fixed bugs in test body motion and removed unnecesary test in move_and_slide. Fixes #25968 2019-02-21 17:21:36 -03:00
Juan Linietsky 0cee7ab4c9 Change snapping to only happen when the floor normal remains as floor, fixes #22312 2019-02-16 15:50:31 -03:00
Juan Linietsky c54330c6b0 Make sure stop on slope can have a tiny bit of precision edge. 2019-02-16 11:19:47 -03:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
piratesephiroth 0e94afbc92 fix stop_on_slope affecting sliding up slopes 2018-12-14 16:02:43 +01:00
DualMatrix 86472ad5a9 Fixed using move_and_slide with stop_on_slope stopping too early
This makes it stop exactly on the slope, I'm not 100% sure if this if this is the correct fix let me know what you think.

Fixes #23675
2018-11-29 02:24:33 +01:00
Juan Linietsky 0032345618 Make sure sync to physics is disabled in editor, fixes #20230 2018-11-21 22:22:43 -03:00
Rémi Verschelde 193d695a1a
Merge pull request #17530 from bojidar-bg/17516-detect-delta
Make it possible to call move_and_slide from _process, even if it is not recommended
2018-11-12 21:14:15 +01:00
Rémi Verschelde 2815e708a0
Merge pull request #23090 from DavidSichma/inconsistent-kinematic
Consistency in KinematicBody
2018-11-12 20:30:38 +01:00
Bojidar Marinov d94c76a199
Make it possible to call move_and_slide from _process, even if it is not recommended
Previously, it would reuse the _physics_process delta, causing it to move faster on faster framerates

Fixes #17516
2018-11-08 20:34:34 +02:00
Juan Linietsky f2e54057ae -Moved EditorDefaultValue to ClassDB, made it core
-Removed one and zero hints for properties, replaced by default value
2018-11-08 11:30:59 -03:00
Guilherme Recchi Cardozo 3fb2069d39 Add method get_collision_exceptions
Adding this method to PhysicsBody, PhysicsBody2D and
SoftBody. It returns a list of nodes included in
collision exceptions.

Fixes #23235, cheers!
2018-11-01 06:41:34 -03:00
David Sichma 6ec4da2e3b Fix inconsistency in KinematicBody
- moved new infinite_inertia argument of move_and_slide and
move_and_slide_with_snap in KinematicBody and KinematicBody2D to the
end if not already there. This makes the order of arguments consistent
and should keep projects from 3.0 compatible as this argument did not
exist in 3.0. Docs updated accordingly.
- renamed max_bounces to max_slides for consistency. Docs updated
accordingly.
- the argument infinite_inertia in test_move is now optional, as it is
in every other movement related method. This closes #22829.
2018-10-17 17:22:14 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde 60570a5e60 PhysicsBody: Don't create PhysicsMaterial override for default friction/bounce
And don't save physics_material_override if null.
2018-09-02 15:08:43 +02:00
Kelly Thomas 1dc8e7c05f Improve ClassDB information for some some signal parameters 2018-09-01 18:05:51 +08:00
Rémi Verschelde 060988408b Physics: Properly obsolete friction and bounce properties
Without this change any new PhysicsBody would show deprecation warnings
due to default values for friction and bounce being defined.

It also enforced a physics material override even when using default
values.
2018-08-29 18:44:42 +02:00
Rémi Verschelde 3b01bf94ad Fix operator precedence in PhysicsBody2D::set_weight
Fixes #16038.
2018-08-29 08:37:08 +02:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Rémi Verschelde ab3716bd46 Revert "Take CanvasLayer transform into account for 2D physics"
This reverts commit 4839e5f6d9.

Fixes #21289.
2018-08-23 21:49:24 +02:00
Pedro J. Estébanez 4839e5f6d9 Take CanvasLayer transform into account for 2D physics
Fixes #18073.
2018-08-21 20:10:15 +02:00
Andrea Catania 0010d9c82a Added ray shape and move_and_slide with snapping on 3D.
Added stop_on_slope on 2d part
2018-08-19 13:45:23 +02:00
Juan Linietsky c02fb271fd apply a threshold for floor angle, fixes #16037, fixes #15632 2018-08-10 13:07:52 -03:00
Juan Linietsky 14fd797c53
Merge pull request #20381 from AndreaCatania/phymat_2
Improved Physics material
2018-08-07 15:31:26 -03:00
Andrea Catania 5e65e28eed Removed physics material combination mode. Added rough and absorbent parameter to material. Fixed 'change' signal connection 2018-08-07 19:38:04 +02:00
Rémi Verschelde 12254594ac Fix PhysicsBody build with deprecated=no
Fixes #20483.
2018-07-27 15:34:58 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Tiger Caldwell 40c7716586 Modified RigidBody, PhysicsDirectBodyState, PhysicsServer, and their respective 2D counterparts to be more consistent and to include more useful methods.
RigidBody:
- Added add_central_force
- Added add_force
- Added add_torque
- Added apply_central_impulse

RigidBody2D:
- Added add_central_force
- Added add_torque
- Added apply_central_impulse
- Added apply_torque_impulse

PhysicsDirectBodyState:
- Added apply_central_impulse

Physics2DDirectBodyState:
- Added add_central_force
- Added add_force
- Added add_torque
- Added apply_central_impulse
- Added apply_impulse
- Added apply_torque_impulse

PhysicsServer:
- Added body_add_force
- Added body_add_torque
- Added body_add_central_force
- Added body_apply_central_impulse

Physics2DServer:
- Added body_add_torque
- Added body_add_central_force
- Added body_apply_central_impulse
- Added body_apply_torque_impulse

Also fixed some small bugs along the way
2018-07-24 05:00:56 -04:00
Juan Linietsky 1ad20dc2f1
Merge pull request #12403 from AndreaCatania/phymat
Physics material
2018-07-23 07:37:03 -03:00
Juan Linietsky 13a801430b Further fixes to KinematicBody2D API, support for sync motion in moving objects 2018-07-17 08:58:04 -03:00
Juan Linietsky e1f2feec2e Changes to how snap works (I think this makes more sense now) 2018-07-16 21:30:44 -03:00
Juan Linietsky 063a22851a -Added support for raycast in KinematicBody2D
-Added support for snapping in KinematicBody2D
2018-07-16 20:04:07 -03:00
AndreaCatania 5f66734d2d Implemented physics material
Hidden a function

Fixed travis static check
2018-05-11 03:23:09 +02:00
Andrea Catania 39fb83630d
Added forgotten infinite_inertia to bindings
Related to this comment: https://github.com/godotengine/godot/pull/16757#discussion_r169470394
2018-02-21 08:42:36 +01:00
Rémi Verschelde 497a4e9e25
Merge pull request #16757 from AndreaCatania/kinpush
Improved kinematic body, Now can move rigid body
2018-02-20 15:41:10 +01:00
Andrea Catania 6ed392f47a Improved kinematic body 2D and 3D, Now can move rigid body 2018-02-20 12:43:47 +01:00
Artem Varaksa d35e486228 Clean up some bad words from code comments 2018-02-17 16:00:39 +03:00
Bernhard Liebl e9237d83c7 Fix crash on deleted rigidbodies without contact monitor (issue 15904) 2018-01-21 12:46:13 +01:00
Rémi Verschelde 9f479f096c Fix typos in code and docs with codespell
Using v1.11.0 from https://github.com/lucasdemarchi/codespell
2018-01-18 22:01:42 +01:00
Juan Linietsky a26e6c8215 Renamed tree_exited to tree_exiting. tree_exited is now used for actual out of tree notification.
Updated doc accordingly.
2018-01-12 08:29:24 -03:00
Bojidar Marinov 9b8e8b2220
Bind many more properties to scripts
Notable potentially breaking changes:
- PROPERTY_USAGE_NOEDITOR is now PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, without PROPERTY_USAGE_INTERNAL
- Some properties were renamed, and sometimes even shadowed by new ones
- New getter methods (some virtual) were added
2018-01-12 00:58:14 +02:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Rémi Verschelde 13c2ff9320 Style: Apply new clang-format 5.0 style to all files 2017-12-07 08:02:00 +01:00
Eric Wiltfang 7dd9e5c57c Fix the prevention for sliding on slopes in the 2d version of move_and_slide
Done by using the same method the 3d counterpart uses.

Fixes #13063.
2017-11-20 01:42:44 +01:00
Juan Linietsky 192a4d7de5 Reworked how servers preallocate RIDs, should fix #10970 2017-11-09 23:35:34 -03:00