Skip to content

Commit d304133

Browse files
committed
Merge branch 'dev1' of https://github.com/AngryAccelerated/Physics2D into dev1
2 parents 7dccbf4 + 338e34d commit d304133

3 files changed

Lines changed: 20 additions & 12 deletions

File tree

CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.6)
22

33
project(physics-engine LANGUAGES CXX)
44
set(CMAKE_AUTOUIC ON)
@@ -107,8 +107,7 @@ add_executable(physics-engine
107107
"testbed/scenes/chain.h"
108108
"testbed/scenes/wreckingball.h"
109109
"testbed/scenes/newtoncradle.h"
110-
"testbed/scenes/pendulum.h"
111-
110+
"testbed/scenes/pendulum.h
112111
"include/geometry/shape/point.h"
113112
"include/geometry/shape/polygon.h"
114113
"include/geometry/shape/rectangle.h"
@@ -121,6 +120,15 @@ add_executable(physics-engine
121120
"include/collision/algorithm/simplex.h"
122121
"include/collision/algorithm/minkowski.h"
123122
"source/collision/algorithm/simplex.cpp"
124-
"source/geometry/shape/point.cpp" "source/geometry/shape/polygon.cpp" "source/geometry/shape/rectangle.cpp" "source/geometry/shape/circle.cpp" "source/geometry/shape/ellipse.cpp" "source/geometry/shape/edge.cpp" "source/geometry/shape/curve.cpp" "source/geometry/shape/capsule.cpp" "source/geometry/shape/sector.cpp")
125-
find_package(Qt5 COMPONENTS Widgets REQUIRED)
126-
target_link_libraries(physics-engine PRIVATE Qt5::Widgets)
123+
"source/geometry/shape/point.cpp"
124+
"source/geometry/shape/polygon.cpp"
125+
"source/geometry/shape/rectangle.cpp"
126+
"source/geometry/shape/circle.cpp"
127+
"source/geometry/shape/ellipse.cpp"
128+
"source/geometry/shape/edge.cpp"
129+
"source/geometry/shape/curve.cpp"
130+
"source/geometry/shape/capsule.cpp"
131+
"source/geometry/shape/sector.cpp"
132+
)
133+
find_package(Qt5 COMPONENTS Widgets REQUIRED)
134+
target_link_libraries(physics-engine PRIVATE Qt5::Widgets)

testbed/scenes/bridge.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace Physics2D
5454
{
5555
rect2 = m_world->createBody();
5656
rect2->setShape(&brick);
57-
rect2->position().set({ -15.0f + i * brick.width(), 0.0f });
57+
rect2->position().set({ -15.0f + i * brick.width() * 1.2f, 0.0f });
5858
rect2->rotation() = 0;
5959
rect2->setMass(1.0f);
6060
rect2->setFriction(0.01f);
@@ -63,8 +63,8 @@ namespace Physics2D
6363
this->m_tree->insert(rect2);
6464
revolutePrim.bodyA = rect;
6565
revolutePrim.bodyB = rect2;
66-
revolutePrim.localPointA.set(half, 0);
67-
revolutePrim.localPointB.set(-half, 0);
66+
revolutePrim.localPointA.set(half + brick.width() * 0.1f, 0);
67+
revolutePrim.localPointB.set(-half - brick.width() * 0.1f, 0);
6868
revolutePrim.dampingRatio = 0.8f;
6969
revolutePrim.frequency = 10;
7070
revolutePrim.maxForce = 10000;
@@ -74,7 +74,7 @@ namespace Physics2D
7474

7575
ppm.bodyA = rect2;
7676
ppm.localPointA.set(0.75f, 0);
77-
ppm.targetPoint.set(-15.0f + max * brick.width() - half, 0.0f);
77+
ppm.targetPoint.set(rect2->toWorldPoint(Vector2(0.75f, 0.0f)));
7878
ppm.dampingRatio = 0.1f;
7979
ppm.frequency = 1000;
8080
ppm.maxForce = 10000;

testbed/scenes/stacking.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Physics2D
2626
m_tree->insert(ground);
2727

2828
real offset = 0.0f;
29-
real max = 20.0;
29+
real max = 25.0;
3030
for (real j = 0; j < max; j += 1.0f)
3131
{
3232
for (real i = 0.0; i < max - j; i += 1.0f)
@@ -35,7 +35,7 @@ namespace Physics2D
3535
body->position().set({ -10.0f + i * 1.1f + offset, j * 1.8f + 2.0f });
3636
body->setShape(&rectangle);
3737
body->rotation() = 0;
38-
body->setMass(1.0f);
38+
body->setMass(0.2f);
3939
body->setType(Body::BodyType::Dynamic);
4040
body->setFriction(0.8f);
4141
body->setRestitution(0.0f);

0 commit comments

Comments
 (0)