Commit Graph

89 Commits

Author SHA1 Message Date
Sasha Szpakowski 6cb0287500 Add optional category bit mask to World:getFixturesInArea. 2023-10-02 12:15:26 -03:00
Sasha Szpakowski 28a898df1f Add World:rayCastAny and World:rayCastClosest.
They return hit position, normal, and ray fraction (if there is a hit), and also take an optional fixture category bitmask parameter.
2023-10-02 12:11:35 -03:00
Sasha Szpakowski c3847d5f04 Rename World:queryBoundingBox to World:queryFixturesInArea.
Matches the new World:getFixturesInArea function.
2023-10-02 11:06:15 -03:00
Sasha Szpakowski d24ccde864 World:rayCast and World:queryBoundingBox have user args passed through to the callback function.
Fixes #1194
2023-10-02 11:00:02 -03:00
Sasha Szpakowski b1609ed83b love.physics: simplify some internal bookkeeping code 2023-10-01 15:55:23 -03:00
Sasha Szpakowski f6cdbdc868 Merge branch 'main' into 12.0-development 2022-12-31 22:46:34 -04:00
Sasha Szpakowski c823dbca96 Update copyright year for 2023 2022-12-31 22:25:49 -04:00
Klonan 4e81a31cd1 Code style (tabs) 2022-08-27 17:35:41 +02:00
Klonan 03939299db Added World:getFixturesInArea() 2022-08-27 17:16:51 +02:00
Alex Szpakowski 7f3538d2ba Merge branch 'main' into 12.0-development 2022-01-05 21:10:27 -04:00
Alex Szpakowski 8e7fd10b6f Update copyright year for 2022 2021-12-31 18:33:40 -04:00
Alex Szpakowski 21f5ba86d3 Merge branch 'master' into 12.0-development 2021-04-07 20:33:44 -03:00
Alex Szpakowski f89aabb0bb Update copyright year for 2021 2021-04-04 16:14:45 -03:00
Garrett Brown 74c6021e8d Starting box2d update 2020-08-16 10:40:04 -04:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski 91d425e7e1 Fix World:getJoints to return fully resolved types for joints. 2019-01-05 10:17:11 -04:00
Alex Szpakowski 3ad16a70da love.physics: move internal box2d->love object map to World instances, and clean up some physics object code. Resolves issue #1465. 2019-01-04 21:36:05 -04:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Bart van Strien 23929cab14 Rename love.physics getObjectList functions to getObjects (resolves #1305)
World:getBodyList -> World:getBodies
World:getContactList -> World:getContacts
World:getJointList -> World:getJoints

Body:getFixtureList -> Body:getFixtures
Body:getContactList -> Body:getContacts
Body:getJointList -> Body:getJoints

Marked the old functions as deprecated

--HG--
branch : minor
2017-09-13 15:48:53 +02:00
Alex Szpakowski b5f2bce0a6 Merge default into minor
--HG--
branch : minor
2017-08-06 03:48:48 -03:00
raidho36 e751278af1 Fix issue #1303 2017-08-02 02:56:02 +03:00
Alex Szpakowski b590edf27d Merge default into minor
--HG--
branch : minor
2017-04-30 00:37:26 -03:00
raidho36 6b7172bd40 Fix Issue #1273
Added Lua index registry clear routine to `destroy` method of classes that use it.
If this is left to GC, the abandoned userdata would stay in memory for one full extra cycle.

Prettified the code slightly. Clarified some comments. Refactored `Fixture` class `udata` name.
Removed Reference class include from `Shape` (it doesn't use it).
2017-04-14 05:53:36 +03:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Bart van Strien d967a755e5 Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type

--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien 5d43c9601a Automatically deduce the type in luax_pushtype, if possible
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski 20b77bd28c Changed World:update(dt) to default to Box2D's recommended 3 internal position iterations instead of 6. Added a new variant World:update(dt, velocityiterations, positioniterations) which lets you specify the number of velocity and position iterations Box2D performs when updating the world. The defaults are 8 and 3 respectively, higher numbers increase precision and reduce performance.
Resolves issue #1135.

--HG--
branch : minor
2016-02-14 20:06:16 -04:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Alex Szpakowski aca369e5d4 Fixed memory leaks in love.physics. When a World is garbage-collected it now implicitly calls World:destroy, which also destroys all Bodies, Fixtures, and Joints that belong to it. 2015-11-17 01:27:48 -04:00
Alex Szpakowski 2cce18946d Fixed objects which store Lua callback functions to avoid attempting to use dead coroutines when deleting the reference to the callback function. Should fix crashes when coroutines are mixed with those objects.
Also improved the performance of World:rayCast and World:queryBoundingBox.
2015-07-18 03:26:07 -03:00
Alex Szpakowski 64b9d40f00 Fixed World:getCallbacks and World:getContactFilter to use the active coroutine's lua state. 2015-07-17 19:00:42 -03:00
Alex Szpakowski 6e92bd8302 Improved the argument type checking for World:setCallbacks, World:setContactFilter, World:queryBoundingBox, and World:rayCast. 2015-04-27 18:48:13 -03:00
Alex Szpakowski 2f419c1c83 Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG--
branch : minor
2015-03-01 18:32:41 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski da7cd267ea Changed luax_pushtype to retain the pushed object itself, but only if the object isn't in the Lua state already.
Previously, calling e.g. love.graphics.getFont() 10,000 times would retain the object 10,000 times (and release it 10,000 times when the Font object was garbage-collected in the Lua state.) Now it will only retain it once and release it once.
2014-08-09 16:04:59 -03:00
Alex Szpakowski d59c76a55f Reduced the number of explicit retain/release method calls on love objects. Less chance of bugs! 2014-08-07 14:53:17 -03:00
Alex Szpakowski 9ab9a393d5 Added Contact:getFixtures and Body:getContactList (see issue #905).
The list of Contacts associated with bodies changes during World:update (potentially multiple times), so you might miss collisions if you don't use the World callbacks at all.
2014-07-07 15:24:24 -03:00
Alex Szpakowski 2ae4e9cd5a Fixed a potential memory leak in the love.physics World callbacks. 2014-06-18 16:24:38 -03:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 5e3a0fbc6e Updated box2d from 2.2.1 to 2.3.0
--HG--
branch : box2d-2.3
2013-11-09 04:30:36 -04:00
Alex Szpakowski 95eedcd1be Using auto for some iterators for less dense-looking code 2013-09-30 02:35:10 -03:00
Alex Szpakowski 93a782d445 Renamed World:setAllowSleeping and World:getAllowSleeping to World:setSleepingAllowed and World:isSleepingAllowed (see issue #691, also consistent with the Body methods) 2013-08-31 21:15:09 -03:00
Alex Szpakowski ec9dec6b80 Replaced luax_newtype with luax_pushtype (and added luax_rawnewtype for the old functionality of luax_newtype.)
luax_pushtype keeps the object in a weak table and checks the table before creating a new userdata, so it re-uses the object's existing wrapper userdata if it can, whenever the object is pushed to Lua.

This fixes some subtle issues with love objects, where using them as keys in tables would not always work as expected (https://love2d.org/forums/viewtopic.php?f=4&t=39398&p=112388#p112415). It also decreases the amount of new Lua objects created, saving the garbage collector some work.
2013-08-29 00:40:06 -03:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
Boolsheet cde5aa3307 Import box2d-contacts branch from love-experiments
Fix issues with Contact lifetime, based on the work of
Matteo "teomat" Goggi
2012-07-24 23:59:42 +02:00
Bart van Strien 7793e7f02f CRLF to LF 2012-07-04 14:40:24 +02:00
rude 81c38e22d0 Applied the new style guidelines.
Well, sort of. Lot's more to be done, but this is a start.
2012-06-28 23:52:33 +02:00
Aidan Gauland 27b62b5c9c Removed scaling of unit vectors. 2012-04-17 20:54:12 +12:00