Commit graph

193 commits

Author SHA1 Message Date
Juan Linietsky 0b1e93ccd4 -Make sure monitorable cant be flipped while flushing queries, fixes #17330
-Also added set_deferred, this was missing.
2018-11-16 08:49:26 -03:00
Juan Linietsky 66c6dfb3fd Ensure that even at slow speed, you will always get collision using kinematic motion. Fixes #16250 2018-11-14 21:21:51 -03:00
Juan Linietsky 3226b44f79 Make sure rotated shapes with one way direction collisions work, fixes #12791 2018-11-10 10:12:35 -03:00
Juan Linietsky d403b4086c 2D Rigid Body CCD should work again, fixes #6664 2018-11-08 15:22:28 -03:00
Juan Linietsky daa1686772
Merge pull request #21386 from RandomShaper/fix-picking-in-canvas-layers
Fix picking in CanvasLayer
2018-11-07 17:51:27 -03:00
Juan Linietsky 121cead38e <fales> end of the week ;-) 2018-11-03 13:30:08 -03:00
Juan Linietsky 3a62f29eef Fix condition test 2018-11-03 13:23:38 -03:00
Juan Linietsky 414097ebd9 Simple workaround to make one way moving platforms work, fixes #9399 2018-11-02 16:22:23 -03:00
Juan Linietsky 64f649a80c -Fix problem in OWC logic closes #11357
-Fix problem with kinematic move and disabled shapes, in both 2D and 3D
2018-11-02 15:45:36 -03:00
Juan Linietsky e52b439eaa
Merge pull request #22933 from SeleckyErik/issue-9148
Fixed non-monitorable areas triggering overlap (reopened)
2018-11-01 12:39:50 -03:00
Rémi Verschelde 1169196f04
Merge pull request #22779 from Superwaitsum/LimitSettings
Limit several project settings
2018-10-25 11:38:06 +02:00
Superwaitsum e5041ad0f5 Add some limits on the Editor Settings 2018-10-24 19:46:33 -05:00
Erik 09250850ec Fixed non-monitorable areas triggering overlap
Non-monitorable areas are never removed from the monitor query of other areas. This makes areas that turn not
monitorable while overlapping with other areas get stuck in the other areas' monitor query and trigger false
overlaps.

This is a  fix for issue #9148.
2018-10-11 12:19:03 +02:00
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
Aaron Franke 37386f112b Remove redundant "== true" code
If it can be compared to a boolean, it can be evaluated as one in-place.
2018-10-06 16:12:36 -04:00
Rémi Verschelde cdc411fd54 Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more
Fixes the following GCC 5 warnings:
```
core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress]
servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress]

drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith]

modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr]

editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive
modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file

editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed
modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed
scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed
scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed
```
2018-09-27 16:33:52 +02:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04: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
Pedro J. Estébanez 6d0f4a4ad7 Fix picking in CanvasLayer
New APIs in 2D physics allow intersection queries filtered by CanvasLayer object instance id. Viewport keep an inventory of its descendant CanvasLayers and takes advantage of all that to test picking with the mouse/touch position correctly transformed for each CanvasLayer.
2018-08-25 00:03:26 +02:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Juan Linietsky ee07fb5ebe Changes to ClippedCamera, RayCast,Raycast2D and 2D physics API to add ability to choose between bodies and areas when colliding. 2018-08-21 15:31:23 -03:00
Thomas Herzog 037f4638ab add project method to Vector2/3 2018-08-16 12:52:38 +02:00
Aaron Franke cf136a91d6 [Core] Completely kill math_2d.h, change includes 2018-08-11 03:08:34 -05: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
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 063a22851a -Added support for raycast in KinematicBody2D
-Added support for snapping in KinematicBody2D
2018-07-16 20:04:07 -03:00
Max Hilbrunner e790d4aafa
Merge pull request #18349 from Gorgexpress/master
Fixed 2D intersect_shape limiting broadphase results
2018-05-26 18:29:49 +02:00
AndreaCatania 5f66734d2d Implemented physics material
Hidden a function

Fixed travis static check
2018-05-11 03:23:09 +02:00
Juan Linietsky 4897373015
Merge pull request #18144 from Crazy-P/Resolves-crash-on-shape2D-culling-for-empty-Concave-shapes
Resolves crash on shape2D culling for empty Concave shapes
2018-05-07 15:35:33 -03:00
Michael 1ba106a71e Fixed 2D intersect_shape limiting broadphase results
Physics2DDirectSpaceStateSW was applying the result limit to broadphase
collision detection instead of narrow. This is inconsistent with its 3D
variant, as well as the rest of the 2D direct space state functions.

Broadphase is now limited by INTERSECTION_QUERY_MAX like everything else,
and narrow phase is exited early when the result limit has been reached.
2018-04-22 06:01:29 -04:00
Rémi Verschelde bf7ca623a6 Fix Coverity reports of uninitialized scalar variable
Fixes most current reports on Coverity Scan of uninitialized scalar
variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html

These happen most of the time (in our code) when instanciating structs
without a constructor (or with an incomplete one), and later returning
the instance. This is sometimes intended though, as some parameters are
only used in some situations and should not be double-initialized for
performance reasons (e.g. `constant` in ShaderLanguage::Token).
2018-04-19 15:20:45 +02:00
Crazy-P 158c7c72c7 Resolves crash on shape2D culling for empty Concave shapes
Fixes https://github.com/godotengine/godot/issues/17789
2018-04-12 18:15:34 +08:00
Juan Linietsky 20e68fef85
Merge pull request #17151 from ShyRed/disabled_shapes_2d
Remove disabled shapes from physics 2D calculations
2018-04-08 11:16:55 -03:00
Bernhard Liebl 9d7856620c Bring back Vector2.cross() 2018-03-07 21:10:31 +01:00
ShyRed 4d6bb43931 Remove disabled shapes from physics
Disabling a shape removes it from physics calculations. Enabling a shape adds it back to the physics calculations.
2018-03-07 18:03:44 +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
Rémi Verschelde b2aeb02e7d
Merge pull request #16530 from AndreaCatania/rays
Improved ray shape (2D and 3D) by addiing the possibility to act as r…
2018-02-19 22:15:49 +01:00
Andrea Catania ffc3ef8677 Improved ray shape (2D and 3D) by addiing the possibility to act as regular shape 2018-02-19 20:59:57 +01:00
Konrad Nowakowski 3659df6624 Fix 2d collision body update on shape remove 2018-02-18 20:46:37 +00:00
Artem Varaksa d35e486228 Clean up some bad words from code comments 2018-02-17 16:00:39 +03:00
Andrea Catania a42765dada Added physics API in order to enable/disable collisions between rigidbody attached to a joint with bullet physics bullet
Fixes #16424
2018-02-05 18:54:07 +01: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