Commit graph

50 commits

Author SHA1 Message Date
PouleyKetchoupp 940838c174 One-directional collision layer check for rigid bodies and soft bodies
Check for each body individually if it collides with the other one or
ignores it.

When a body is being ignored, the other body's mass is considered
infinite when applying impulses to avoid extra overlapping.
2021-07-19 17:24:04 -07:00
Marcel Admiraal b8fe576355 Ensure KinematicBodies only interact with other Bodies with matching mask. 2021-07-19 17:03:43 +01:00
PouleyKetchoupp a65cdca894 Fix and clean disabled shapes handling in godot physics servers
In 3D, disabled shapes are now not added to the broadphase anymore.
Since they are removed right away when disabled, no need to check for
disabled shapes for any query that comes from the broadphase.
Also Fixes raycast queries returning disabled shapes.

In 2D, disabled shapes where already not added to the broadphase.
Remove the same unnecessary checks as in 3D.

Overall harmonized API for disabled shapes in the physics servers and
removed duplicate method.
2021-06-22 16:51:47 -07:00
PouleyKetchoupp 448c41a3e4 Godot Physics collisions and solver processed on threads
Use ThreadWorkPool to process physics step tasks in multiple threads. Collisions are all processed in parallel and solving impulses is
processed in parallel for rigid body islands.

Additional changes:
- Proper islands for soft bodies linked to active bodies
- All moving areas are on separate islands (can be parallelized)
- Fix inconsistencies with body islands (Kinematic bodies could link
bodies together or not depending on the processing order)
- Completely prevent static bodies to be active (it could cause islands
to be wrongly created and cause dangerous multi-threading operations as
well as inconsistencies in created islands)
- Apply impulses only on dynamic bodies to avoid unsafe multi-threaded
operations (static bodies can be on multiple islands)
- Removed inverted iterations when populating body islands, it's now
faster in regular order (maybe after fixing inconsistencies)
2021-04-26 18:26:00 -07:00
PouleyKetchoupp c5d2404a13 Fix GodotPhysics solver with kinematic body set to report contacts
In 3D, collision is disabled between kinematic/static bodies when
contacts are generated only to report them.

In 2D, this case was already fixed but the code is cleaned to make it
easier to follow.
2021-03-11 18:06:00 -07:00
Marcel Admiraal 7653b8cc1e Fix multiple issues with one-way collisions
For RigidBodies, uses the collision normal determined by relative motion
to determine whether or not a one-way collision has occurred.

For KinematicBodies, performs additional checks to ensure a one-way
collision has occurred, and averages the recovery step over all collision
shapes.

Co-authored-by:    Sergej Gureev <sergej.gureev@relex.fi>
2021-01-07 09:22:39 +00:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
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 🎆
2021-01-01 20:19:21 +01:00
Rémi Verschelde 058f3fe069
Merge pull request #44149 from madmiraal/rename-tangent-orthogonal
Rename Vector2.tangent() to Vector2.orthogonal()
2020-12-28 16:00:12 +01:00
Marcel Admiraal a24c38d1a8 Rename Vector2.tangent() to Vector2.orthogonal() 2020-12-06 18:16:06 +00:00
Jordan Schidlowsky 043b6c2d93 make 2d constraint solving more deterministic by solving in push order 2020-12-04 22:23:12 -06:00
TwistedTwigleg 0205eef96b Fixed 2D physics regression that causes RigidBody2D nodes to spin uncontrollably when colliding 2020-08-28 14:16:12 -04:00
Cevantime 23f7d2c29d fix laxist collision detection on one way shapes 2020-07-03 11:24:15 +02:00
Aaron Franke ba27deef06
Refactor physics force and impulse code 2020-06-02 23:18:59 -04:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
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-05-14 16:54:55 +02:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Juan Linietsky cb09abdbbd Fixed OWC for rigid bodies, closes #25732 2019-02-12 08:40:18 -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
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04: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
AndreaCatania 5f66734d2d Implemented physics material
Hidden a function

Fixed travis static check
2018-05-11 03:23:09 +02: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
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
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Juan Linietsky 6ba1e4677b -Trigger shapes removed in 2D, they became obsolete long ago when areas could detect their own overlap
-Added ability to disable individual collisionshape/polygon
-Moved One Way Collision to shape, allowing more flexibility
-Changed internals of CollisionObject, shapes are generated from child nodes on the fly, not stored inside any longer.
-Modifying a CollisionPolygon2D on the fly now works, it can even be animated.

Will port this to 3D once well tested. Have fun!
2017-06-23 23:39:52 -03:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Ferenc Arn eae94ba1c8 Use real_t as floating point type in physics code.
This is a continuation of an on-going work for 64-bit floating point builds, started in PR #7528. Covers physics, physics/joints and physics_2d code.

Also removed matrixToEulerXYZ function in favor of Basis::get_euler.
2017-02-13 17:42:02 -06:00
Juan Linietsky 52e2a1e98d fixed to 2D physics, makes it work again 2017-01-15 09:50:27 -03:00
Juan Linietsky bc26f90581 Type renames:
Matrix32 -> Transform2D
	Matrix3 -> Basis
	AABB -> Rect3
	RawArray -> PoolByteArray
	IntArray -> PoolIntArray
	FloatArray -> PoolFloatArray
	Vector2Array -> PoolVector2Array
	Vector3Array -> PoolVector3Array
	ColorArray -> PoolColorArray
2017-01-11 00:52:51 -03:00
Ferenc Arn f271591ac2 Various corrections in 2D math.
This is the follow up for the 2D changes mentioned in PR #6865. It fixes various mistakes regarding the order of matrix indices, order of transformation operations, usage of atan2 function and ensures that the sense of rotation is compatible with a left-handed coordinate system with Y-axis pointing down (which flips the sense of rotations along the z-axis). Also replaced float with real_t, and tried to make use of Matrix32 methods rather than accessing its elements directly.

Affected code in the Godot code base is also fixed in this commit.

The user code using functions involving angles such as atan2, angle_to, get_rotation, set_rotation will need to be updated to conform with the new behavior. Furthermore, the sign of the rotation angles in existing 2D scene files need to be flipped as well.
2017-01-10 10:14:20 -06:00
Rémi Verschelde c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
Ovnuniarchos b09b449615 Optimized one way collision loops. 2016-06-24 08:43:23 +02:00
Hubert Jarosz 4a4f247914
remove trailing whitespace 2016-03-09 00:00:52 +01:00
Juan Linietsky 0ed864d876 properly removing unprocessed objects from physics islands fixes one way platforms for rigidbodies, closes #2345 2016-01-01 12:13:17 -03:00
George Marques 5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
Juan Linietsky 83d9a692be Ability to visually debug geometry visually:
-Visible 2D and 3D Shapes, Polygons, Tile collisions, etc.
-Visible Navmesh and Navpoly
-Visible collision contacts for 2D and 3D as a red point
-Customizable colors in project settings
2015-09-20 13:03:46 -03:00
Juan Linietsky 32b1b472af -improved one-way collision handling in both dynamic and character bodies for 2D, fixes #1854 2015-05-10 19:24:09 -03:00
Juan Linietsky 767f71a35e -Made one way collision work with 2D physics (rigidbody) 2015-05-03 18:18:21 -03:00
Juan Linietsky af06843982 -new collision layer & mask system for 2D, for more flexible collision masking 2015-05-03 16:47:21 -03:00
Juan Linietsky fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00
Juan Linietsky f75ae815d5 -CCD in 3D physics was not working (code was not even there!) re-added, fixes 1067 2015-01-05 23:00:35 -03:00
Juan Linietsky af4a97bef9 missing fils from yesterday comit.
must have made some mistake with git,
not sure why they were not sent..
2014-10-03 08:58:41 -03:00
Juan Linietsky b324ff7ea5 A bit of everything:
-IMA-ADPCM support for samples, this means that sound effects can be compressed and use 4 timess less RAM.
-New 3D import workflow based on Wavefront OBJ. Import single objects as mesh resources instead of full scenes. Many people prefers to work this way. Just like the rest of the imported resources, these are updated in realtime if modified externally.
-Mesh resources now support naming surfaces. This helps reimporting to identify which user-created materials must be kept.
-Several fixes and improvements to SurfaceTool.
-Anti Aliasing added to WorldEnvironment effects (using FXAA)
-2D Physics bodies (RigidBody, KinematicBody, etc), Raycasts, Tilemap, etc support collision layers. This makes easy to group which objects collide against which.
-2D Trigger shapes can now also trigger collision reporting in other 2D bodies (it used to be in Area2D before)
-Viewport render target textures can now be filtered.
-Few fixes in GDscript make it easier to work with static functions and class members.
-Several and many bugfixes.
2014-05-14 01:22:15 -03:00
Juan Linietsky 9f33134c93 -Support for changing fonts
-Detect when free() might crash the project and throw error
-fixed 2D Bounce in physics (3d still broken)
-renamed “on_top” property to “behind_parent”, which makes more sense, old on_top remains there for compatibility but is invisible.
-large amount of fixes
2014-04-05 12:39:30 -03:00
Juan Linietsky d7d65fa2f2 -improved physics ccd
-html5 exporter works again
-disable repeat on image loader by default
-can change shape offset en tileset, texture offset was broken
2014-02-19 11:57:14 -03:00
Juan Linietsky 0b806ee0fc GODOT IS OPEN SOURCE 2014-02-09 22:10:30 -03:00