Commit Graph

340 Commits

Author SHA1 Message Date
Sasha Szpakowski 762672882e physics: newCircleBody and friends return the shape as a second return value. 2026-03-30 23:08:32 -03:00
John Doe fc5eeb11a3 Fix copyright notice date 2026-01-21 18:49:11 +00:00
John Doe 6f08eb94c6 Update copyright notice with correct year 2025-07-12 23:19:22 +01:00
Sasha Szpakowski fe23e1920b Fix some compile warnings 2024-12-29 14:09:13 -04:00
Sasha Szpakowski 12bbadb0fa replace 'onesided' bool in EdgeShape constructors with prev/next vertex coordinates. 2024-06-16 11:17:46 -03:00
Sasha Szpakowski d13a7f7620 Fix missing deprecated Shape:getShape method. 2024-06-07 17:38:08 -03:00
Sasha Szpakowski 1e97e09b28 Rework internal module registration to happen in constructors. 2024-02-24 15:21:38 -04:00
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
Sasha Szpakowski 94d5864144 update year for copyright notice 2024-02-10 12:13:22 -04:00
Sasha Szpakowski 8951635abc Merge branch 'main' into 12.0-development 2023-12-02 13:40:49 -04:00
Sasha Szpakowski 69dbb15027 Fix return value of Shape:testPoint. 2023-11-22 19:43:09 -04:00
Sasha Szpakowski 2aad15c865 Fix DistanceJoint type information 2023-10-14 16:42:31 -03:00
Sasha Szpakowski 27c4569697 love.physics: clean up some internal collision processing code 2023-10-08 14:06:55 -03:00
Sasha Szpakowski 112a09ceb7 Shape:setDensity no longer needs Body:resetMassData unless the Body already has custom mass data.
Add Body:hasCustomMassData.
If the Body has custom mass data, attaching a Shape to it doesn't automatically reset its mass data.
2023-10-08 12:43:27 -03:00
Sasha Szpakowski de3a0c0142 Improve error checking in love.physics.new*Shape 2023-10-07 15:33:15 -03:00
Sasha Szpakowski a1e4b649ce Fix compile errors on macOS 2023-10-07 15:33:01 -03:00
Sasha Szpakowski ac9ae82524 love.physics: simplify Body and Shape API.
#1130

- Shapes are now directly attached to Bodies when they're created (similar to love 0.7 and older).
- Fixtures are removed.
- All methods that were in Fixtures now exist in Shapes.
- All APIs that used or returned a Fixture now do the same with a Shape.

- Add new love.physics.new*Shape variants that take a Body as the first parameter.
- Deprecate the new*Shape APIs that don't take a Body.
- Deprecate love.physics.newFixture (the deprecated function now returns a Shape).
- Replace Body:getFixture and Body:getFixtures with Body:getShape and Body:getShapes (Body:getFixtures is deprecated).
- Replace World:queryFixturesInArea and World:getFixturesInArea with World:queryShapesInArea and World:getShapesInArea (queryFixturesInArea is deprecated).
- Replace Contact:getFixtures with Contact:getShapes (Contact:getFixtures is deprecated).
- Replace all love.physics callback Fixture parameters with Shape parameters.
- Deprecate ChainShape:getChildEdge.
2023-10-07 15:17:24 -03:00
Sasha Szpakowski 2702004bb2 Add Body:getFixture.
Convenience method to get the first Fixture attached to the body.
2023-10-04 20:00:44 -03:00
Sasha Szpakowski 51b439822b Add convenience functions for creating a Body+Shape+Fixture all at once.
#1130.

- Add love.physics.newCircleBody(world, bodytype, x, y, radius)
- Add love.physics.newRectangleBody(world, bodytype, x, y, w, h [, angle])
- Add love.physics.newPolygonBody(world, bodytype, coords)
- Add love.physics.newEdgeBody(world, bodytype, x1, y1, x2, y2 [, onesided])
- Add love.physics.newChainBody(world, bodytype, loop, coords)

All new functions return a Body object. The body's world position is at the center of the given coordinates, and the shape's local origin is at its center.
2023-10-04 19:56:22 -03:00
Sasha Szpakowski 03b6b9ff13 Fix return value counts... 2023-10-02 14:08:21 -03:00
Sasha Szpakowski da430d5145 World:rayCastAny and rayCastClosest also return the fixture they hit. 2023-10-02 14:05:54 -03:00
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 95d44c2c2d very minor compile speed improvements 2023-02-11 16:29:24 -04:00
Sasha Szpakowski f6b74e9ce7 WheelJoint:getMotorTorque takes a dt param instead of inverse dt.
Matches the change made to RevoluteJoint:getMotorTorque.
2023-01-13 18:10:45 -04:00
Sasha Szpakowski f6cdbdc868 Merge branch 'main' into 12.0-development 2022-12-31 22:46:34 -04:00
Sasha Szpakowski 0b75f6cfa5 Missed some files... 2022-12-31 22:36:48 -04:00
Sasha Szpakowski c823dbca96 Update copyright year for 2023 2022-12-31 22:25:49 -04:00
Jack Robinson a37803507f Remove getters/setters for frequency from Physics joints 2022-12-04 15:06:39 +13:00
Jack Robinson cd52af20a7 Fix #1834: Give MouseJoint a sensible stiffness and damping initial value 2022-11-02 19:42:48 +13:00
Klonan 7595bc7edb whitespace micro 2022-08-27 17:37:30 +02: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
megagrump 85894ad5e4 use dt instead of inv_dt in RevoluteJoint::getMotorTorque 2021-11-21 01:04:48 +01:00
Alex Szpakowski 433190d1df Merge branch 'master' into 12.0-development 2021-06-06 11:43:54 -03:00
Alex Szpakowski 977c690fa9 Fix physics meter value persisting after love.event.quit("restart").
Fixes #1685
2021-04-11 19:53:16 -03:00
Alex Szpakowski 9b4aea8f17 Missed some copyright date updates 2021-04-07 20:34:24 -03: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
Alex Szpakowski 633d2fa5c8 Merge branch 'master' into 12.0-development 2021-01-06 21:49:34 -04:00
Qais Patankar 562cc6b1cb Fix #1614: add Body:getLocalPoints 2020-12-30 04:27:48 +00:00
Alex Szpakowski fc2cf602f6 Fix RopeJoints not working. 2020-11-12 23:46:49 -04:00
Alex Szpakowski cbde2ce76c Merge pull request #1613 from thegrb93/box2d-update
Box2d update to 2.4.1
2020-11-02 21:27:57 -04:00
Garrett Brown 1b74b34cce Update userdata stuff to how new box2d wants it 2020-10-17 22:30:01 -04:00
Garrett Brown 77f238767f Update to box2d 2.4.1 2020-10-17 22:15:18 -04:00