From 922227a2a778227e54a513840c9622e674b2c852 Mon Sep 17 00:00:00 2001
From: Kan <70838508+kan6868@users.noreply.github.com>
Date: Thu, 10 Jul 2025 19:17:56 +0700
Subject: [PATCH 1/6] Add wheel joint v2 to api
Syntax:
```
local joint = physics.newJoint("wheelV2", objA, objB, objB.x, objB.y, 0, 1);
```
---
librtt/Rtt_LuaLibPhysics.cpp | 24 +++++
librtt/Rtt_PhysicsJoint.cpp | 196 +++++++++++++++++++++++++++++++++--
2 files changed, 214 insertions(+), 6 deletions(-)
diff --git a/librtt/Rtt_LuaLibPhysics.cpp b/librtt/Rtt_LuaLibPhysics.cpp
index 46dde3db8..f210d3629 100644
--- a/librtt/Rtt_LuaLibPhysics.cpp
+++ b/librtt/Rtt_LuaLibPhysics.cpp
@@ -1044,6 +1044,7 @@ static const char kPistonJointType[] = "piston";
static const char kFrictionJointType[] = "friction";
static const char kWeldJointType[] = "weld"; // note: has no type-specific methods
static const char kWheelJointType[] = "wheel"; // combines a piston and a pivot joint, like a wheel on a shock absorber
+static const char kWheelV2JointType[] = "wheelV2"; // combines a piston and a pivot joint, like a wheel on a shock absorber
static const char kPulleyJointType[] = "pulley";
static const char kTouchJointType[] = "touch";
static const char kGearJointType[] = "gear";
@@ -1318,6 +1319,29 @@ newJoint( lua_State *L )
result = CreateAndPushJoint( luaStateHandle, physics, jointDef );
}
+ else if (strcmp(kWheelV2JointType, jointType) == 0)
+ {
+ b2Body* body1 = e1->GetBody();
+ b2Body* body2 = e2->GetBody();
+
+ Real px = luaL_torealphysics(L, 4, scale);
+ Real py = luaL_torealphysics(L, 5, scale);
+
+ Real qx = luaL_torealphysics(L, 6, scale);
+ Real qy = luaL_torealphysics(L, 7, scale);
+
+ b2WheelJointDefV2 jointDef;
+
+ b2Vec2 point(px, py);
+ b2Vec2 axis(qx, qy);
+
+ axis.Normalize();
+
+ jointDef.Initialize(body1, body2, point, axis);
+
+ result = CreateAndPushJoint(luaStateHandle, physics, jointDef);
+ }
+
else if ( strcmp( kPulleyJointType, jointType ) == 0 )
{
b2Body *body1 = e1->GetBody();
diff --git a/librtt/Rtt_PhysicsJoint.cpp b/librtt/Rtt_PhysicsJoint.cpp
index 87bf5ac65..363e20bdf 100644
--- a/librtt/Rtt_PhysicsJoint.cpp
+++ b/librtt/Rtt_PhysicsJoint.cpp
@@ -105,6 +105,7 @@ ShouldGetLocalAnchor( b2JointType jointType )
case e_prismaticJoint:
case e_frictionJoint:
case e_wheelJoint:
+ case e_wheelJointV2:
case e_weldJoint:
case e_ropeJoint:
result = true;
@@ -155,6 +156,9 @@ GetLocalAnchorACallback( b2JointType jointType )
case e_wheelJoint:
result = & GetLocalAnchorA< b2WheelJoint >;
break;
+ case e_wheelJointV2:
+ result = &GetLocalAnchorA< b2WheelJointV2 >;
+ break;
case e_weldJoint:
result = & GetLocalAnchorA< b2WeldJoint >;
break;
@@ -191,6 +195,9 @@ GetLocalAnchorBCallback( b2JointType jointType )
case e_wheelJoint:
result = & GetLocalAnchorB< b2WheelJoint >;
break;
+ case e_wheelJointV2:
+ result = &GetLocalAnchorB< b2WheelJointV2 >;
+ break;
case e_weldJoint:
result = & GetLocalAnchorB< b2WeldJoint >;
break;
@@ -279,6 +286,7 @@ ShouldGetLocalAxis( b2JointType jointType )
{
case e_prismaticJoint:
case e_wheelJoint:
+ case e_wheelJointV2:
result = true;
break;
@@ -311,6 +319,8 @@ GetLocalAxisACallback( b2JointType jointType )
break;
case e_wheelJoint:
result = & GetLocalAxisA< b2WheelJoint >;
+ case e_wheelJointV2:
+ result = &GetLocalAxisA< b2WheelJointV2 >;
break;
default:
@@ -425,9 +435,17 @@ PhysicsJoint::setLimits( lua_State *L )
"the lower and upper limits. We assume you meant to set the lower limit as "
"%g and the upper limit as %g.\n", lowerLimit, upperLimit ) );
}
+ if (baseJoint->GetType() == e_wheelJointV2)
+ {
+ b2WheelJointV2* joint = (b2WheelJointV2*)baseJoint;
+ joint->SetLimits(Rtt_RealToFloat(lowerLimit), Rtt_RealToFloat(upperLimit));
+ }
+ else
+ {
+ b2PrismaticJoint* joint = (b2PrismaticJoint*)baseJoint;
+ joint->SetLimits(Rtt_RealToFloat(lowerLimit), Rtt_RealToFloat(upperLimit));
+ }
- b2PrismaticJoint *joint = (b2PrismaticJoint*)baseJoint;
- joint->SetLimits( Rtt_RealToFloat( lowerLimit ), Rtt_RealToFloat( upperLimit ) );
}
return 0;
@@ -443,12 +461,23 @@ PhysicsJoint::getLimits( lua_State *L )
{
const PhysicsWorld& physics = LuaContext::GetRuntime( L )->GetPhysicsWorld();
Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real lowerLimit = 0.0;
+ Rtt_Real upperLimit = 0.0;
+ if (baseJoint->GetType() == e_wheelJointV2)
+ {
+ b2WheelJointV2* joint = (b2WheelJointV2*)baseJoint; // assumption: this cast is OK for both cases (otherwise check type)
- b2PrismaticJoint *joint = (b2PrismaticJoint*)baseJoint; // assumption: this cast is OK for both cases (otherwise check type)
+ lowerLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetLowerLimit()), scale);
+ upperLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetUpperLimit()), scale);
+ }
+ else
+ {
+ b2PrismaticJoint* joint = (b2PrismaticJoint*)baseJoint; // assumption: this cast is OK for both cases (otherwise check type)
+
+ lowerLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetLowerLimit()), scale);
+ upperLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetUpperLimit()), scale);
+ }
- Rtt_Real lowerLimit = Rtt_RealMul( Rtt_FloatToReal( joint->GetLowerLimit() ), scale );
- Rtt_Real upperLimit = Rtt_RealMul( Rtt_FloatToReal( joint->GetUpperLimit() ), scale );
-
lua_pushnumber( L, lowerLimit );
lua_pushnumber( L, upperLimit );
}
@@ -894,6 +923,88 @@ PhysicsJoint::ValueForKey( lua_State *L )
result = 0;
}
}
+ else if (jointType == e_wheelJointV2)
+ {
+ //////////////////////////////////////////////////////////////////////////////
+ // This is exposed as a "wheel" joint in Corona (aka "line" in Box2D terms)
+
+ b2WheelJointV2 *joint = (b2WheelJointV2*)baseJoint;
+
+ if (0 == strcmp("isMotorEnabled", key))
+ {
+ lua_pushboolean(L, joint->IsMotorEnabled());
+ }
+ else if (0 == strcmp("motorSpeed", key))
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetMotorSpeed()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("motorTorque", key)) // read-only
+ {
+ lua_pushnumber(L, joint->GetMaxMotorTorque());
+ }
+ else if (0 == strcmp("maxMotorTorque", key))
+ {
+ lua_pushnumber(L, joint->GetMaxMotorTorque());
+ }
+ else if (strcmp("getLocalAxisA", key) == 0)
+ {
+ lua_pushlightuserdata(L, (void*)GetLocalAxisACallback(e_wheelJoint));
+ lua_pushcclosure(L, Self::getLocalAxis, 1);
+ }
+ else if (0 == strcmp("jointTranslation", key)) // read-only
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetJointTranslation()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("jointLinearSpeed", key)) // read-only
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetJointLinearSpeed()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("jointAngularSpeed", key)) // read-only
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetJointAngularSpeed()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("jointAngle", key)) // read-only
+ {
+ Rtt_Real valueDegrees = Rtt_RealRadiansToDegrees(Rtt_FloatToReal(joint->GetJointAngle()));
+ lua_pushnumber(L, valueDegrees);
+ }
+ else if (strcmp("springStiffness", key) == 0)
+ {
+ lua_pushnumber(L, joint->GetStiffness());
+ }
+ else if (strcmp("springDampingRatio", key) == 0)
+ {
+ lua_pushnumber(L, joint->GetDamping());
+ }
+ else if (0 == strcmp("isLimitEnabled", key))
+ {
+ lua_pushboolean(L, joint->IsLimitEnabled());
+ }
+ else if (strcmp("setLimits", key) == 0)
+ {
+ lua_pushcfunction(L, Self::setLimits);
+ }
+ else if (strcmp("getLimits", key) == 0)
+ {
+ lua_pushcfunction(L, Self::getLimits);
+ }
+ else
+ {
+ result = 0;
+ }
+ }
else if ( jointType == e_pulleyJoint )
{
//////////////////////////////////////////////////////////////////////////////
@@ -1285,7 +1396,80 @@ PhysicsJoint::SetValueForKey( lua_State *L )
}
}
}
+ else if (jointType == e_wheelJointV2)
+ {
+ //////////////////////////////////////////////////////////////////////////////
+ // This is exposed as a "wheel" joint in Corona (aka "line" in Box2D terms)
+
+ b2WheelJointV2 *joint = (b2WheelJointV2*)baseJoint;
+
+ if (0 == strcmp("isMotorEnabled", key))
+ {
+ if (lua_isboolean(L, 3))
+ {
+ joint->EnableMotor(lua_toboolean(L, 3));
+ }
+ }
+ else if (0 == strcmp("isLimitEnabled", key))
+ {
+ if (lua_isboolean(L, 3))
+ {
+ joint->EnableLimit(lua_toboolean(L, 3));
+ }
+ }
+ else if (0 == strcmp("motorSpeed", key))
+ {
+ if (lua_isnumber(L, 3))
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valueMeters = Rtt_RealDiv(Rtt_FloatToReal(lua_tonumber(L, 3)), scale);
+ joint->SetMotorSpeed(Rtt_RealToFloat(valueMeters));
+ }
+ }
+ else if (0 == strcmp("motorTorque", key))
+ {
+ // No-op for read-only property
+ }
+ else if (0 == strcmp("maxMotorTorque", key))
+ {
+ if (lua_isnumber(L, 3))
+ {
+ joint->SetMaxMotorTorque(lua_tonumber(L, 3));
+ }
+ }
+ else if (0 == strcmp("jointTranslation", key))
+ {
+ // No-op for read-only property
+ }
+ else if (0 == strcmp("jointLinearSpeed", key))
+ {
+ // No-op for read-only property
+ }
+ else if (0 == strcmp("jointAngularSpeed", key))
+ {
+ // No-op for read-only property
+ }
+ else if (0 == strcmp("jointAngle", key))
+ {
+ // No-op for read-only property
+ }
+ else if (strcmp("springStiffness", key) == 0)
+ {
+ if (lua_isnumber(L, 3))
+ {
+ joint->SetStiffness(lua_tonumber(L, 3));
+ }
+ }
+ else if (strcmp("springDampingRatio", key) == 0)
+ {
+ if (lua_isnumber(L, 3))
+ {
+ joint->SetDamping(lua_tonumber(L, 3));
+ }
+ }
+ }
else if ( jointType == e_pulleyJoint )
{
//////////////////////////////////////////////////////////////////////////////
From 5ec93f20b63bcff8f324ec417268e08f75b1110f Mon Sep 17 00:00:00 2001
From: Kan <70838508+kan6868@users.noreply.github.com>
Date: Thu, 10 Jul 2025 19:18:36 +0700
Subject: [PATCH 2/6] Add to build list android/window/html/linux
---
platform/android/ndk/CMakeLists.txt | 1 +
platform/emscripten/gmake/Box2D.make | 5 +++++
platform/linux/CMakeList.txt | 1 +
platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj | 2 ++
.../Box2D.Library/Box2D.Library.Win32.vcxproj.filters | 6 ++++++
5 files changed, 15 insertions(+)
diff --git a/platform/android/ndk/CMakeLists.txt b/platform/android/ndk/CMakeLists.txt
index 4163e340d..c99993741 100644
--- a/platform/android/ndk/CMakeLists.txt
+++ b/platform/android/ndk/CMakeLists.txt
@@ -722,6 +722,7 @@ add_library( corona SHARED
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2WeldJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2WheelJoint.cpp
+ ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2WheelJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Particle/b2Particle.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Particle/b2ParticleAssembly.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Particle/b2ParticleGroup.cpp
diff --git a/platform/emscripten/gmake/Box2D.make b/platform/emscripten/gmake/Box2D.make
index d8183b3a7..8d040477f 100644
--- a/platform/emscripten/gmake/Box2D.make
+++ b/platform/emscripten/gmake/Box2D.make
@@ -115,6 +115,7 @@ OBJECTS := \
$(OBJDIR)/b2RopeJoint.o \
$(OBJDIR)/b2WeldJoint.o \
$(OBJDIR)/b2WheelJoint.o \
+ $(OBJDIR)/b2WheelJointV2.o \
$(OBJDIR)/b2Particle.o \
$(OBJDIR)/b2ParticleAssembly.o \
$(OBJDIR)/b2ParticleGroup.o \
@@ -368,6 +369,10 @@ $(OBJDIR)/b2WheelJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2WheelJ
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+$(OBJDIR)/b2WheelJointV2.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2WheelJointV2.cpp
+ @echo $(notdir $<)
+ $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+
$(OBJDIR)/b2Particle.o: ../../../external/Box2D/Box2D/Particle/b2Particle.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
diff --git a/platform/linux/CMakeList.txt b/platform/linux/CMakeList.txt
index ee1677998..0a18d39d4 100644
--- a/platform/linux/CMakeList.txt
+++ b/platform/linux/CMakeList.txt
@@ -784,6 +784,7 @@ SET( SOLAR2D_SOURCES
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2WeldJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2WheelJoint.cpp
+ ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2WheelJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Particle/b2Particle.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Particle/b2ParticleAssembly.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Particle/b2ParticleGroup.cpp
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
index fbaa56b9e..c4c495404 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
@@ -67,6 +67,7 @@
+
@@ -124,6 +125,7 @@
+
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
index d2465ee14..cca5b802a 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
@@ -176,6 +176,9 @@
Rope
+
+ Dynamics\Joints
+
@@ -366,5 +369,8 @@
Rope
+
+ Dynamics\Joints
+
\ No newline at end of file
From ab9a0fb2b432fb2acf48f859b4778f0c4b4e0682 Mon Sep 17 00:00:00 2001
From: Kan <70838508+kan6868@users.noreply.github.com>
Date: Thu, 10 Jul 2025 20:30:55 +0700
Subject: [PATCH 3/6] Add b2PrismaticJointV2 to build list
android/window/html/linux
---
external/Box2D | 2 +-
platform/android/ndk/CMakeLists.txt | 1 +
platform/emscripten/gmake/Box2D.make | 5 +++++
platform/linux/CMakeList.txt | 1 +
platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj | 2 ++
.../Box2D.Library/Box2D.Library.Win32.vcxproj.filters | 6 ++++++
6 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/external/Box2D b/external/Box2D
index c7ac8556d..a32b63b57 160000
--- a/external/Box2D
+++ b/external/Box2D
@@ -1 +1 @@
-Subproject commit c7ac8556d8d6834ec187820dbfdfa311c655ba6b
+Subproject commit a32b63b5754e34f8f31188e48a35e37330c8317d
diff --git a/platform/android/ndk/CMakeLists.txt b/platform/android/ndk/CMakeLists.txt
index c99993741..9368d98d4 100644
--- a/platform/android/ndk/CMakeLists.txt
+++ b/platform/android/ndk/CMakeLists.txt
@@ -717,6 +717,7 @@ add_library( corona SHARED
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MouseJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
+ ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
diff --git a/platform/emscripten/gmake/Box2D.make b/platform/emscripten/gmake/Box2D.make
index 8d040477f..381063f00 100644
--- a/platform/emscripten/gmake/Box2D.make
+++ b/platform/emscripten/gmake/Box2D.make
@@ -110,6 +110,7 @@ OBJECTS := \
$(OBJDIR)/b2MotorJoint.o \
$(OBJDIR)/b2MouseJoint.o \
$(OBJDIR)/b2PrismaticJoint.o \
+ $(OBJDIR)/b2PrismaticJointV2.o \
$(OBJDIR)/b2PulleyJoint.o \
$(OBJDIR)/b2RevoluteJoint.o \
$(OBJDIR)/b2RopeJoint.o \
@@ -349,6 +350,10 @@ $(OBJDIR)/b2PrismaticJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2Pr
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+$(OBJDIR)/b2PrismaticJointV2.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
+ @echo $(notdir $<)
+ $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+
$(OBJDIR)/b2PulleyJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
diff --git a/platform/linux/CMakeList.txt b/platform/linux/CMakeList.txt
index 0a18d39d4..c0058c487 100644
--- a/platform/linux/CMakeList.txt
+++ b/platform/linux/CMakeList.txt
@@ -779,6 +779,7 @@ SET( SOLAR2D_SOURCES
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MouseJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
+ ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
index c4c495404..96071a224 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
@@ -62,6 +62,7 @@
+
@@ -120,6 +121,7 @@
+
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
index cca5b802a..432cd1010 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
@@ -179,6 +179,9 @@
Dynamics\Joints
+
+ Dynamics\Joints
+
@@ -372,5 +375,8 @@
Dynamics\Joints
+
+ Dynamics\Joints
+
\ No newline at end of file
From 7e715416f90a189809aeb3216132c06df9701e53 Mon Sep 17 00:00:00 2001
From: Kan <70838508+kan6868@users.noreply.github.com>
Date: Thu, 10 Jul 2025 20:31:21 +0700
Subject: [PATCH 4/6] add prismatic joint v2
---
librtt/Rtt_LuaLibPhysics.cpp | 26 +++++-
librtt/Rtt_PhysicsJoint.cpp | 151 ++++++++++++++++++++++++++++++++++-
2 files changed, 174 insertions(+), 3 deletions(-)
diff --git a/librtt/Rtt_LuaLibPhysics.cpp b/librtt/Rtt_LuaLibPhysics.cpp
index f210d3629..777a4089c 100644
--- a/librtt/Rtt_LuaLibPhysics.cpp
+++ b/librtt/Rtt_LuaLibPhysics.cpp
@@ -1041,10 +1041,11 @@ InitializeFixtureFromLua( lua_State *L,
static const char kDistanceJointType[] = "distance";
static const char kPivotJointType[] = "pivot";
static const char kPistonJointType[] = "piston";
+static const char kPistonJointV2Type[] = "pistonV2";
static const char kFrictionJointType[] = "friction";
static const char kWeldJointType[] = "weld"; // note: has no type-specific methods
static const char kWheelJointType[] = "wheel"; // combines a piston and a pivot joint, like a wheel on a shock absorber
-static const char kWheelV2JointType[] = "wheelV2"; // combines a piston and a pivot joint, like a wheel on a shock absorber
+static const char kWheelV2JointType[] = "wheelV2"; // wheel joint v2.4.2
static const char kPulleyJointType[] = "pulley";
static const char kTouchJointType[] = "touch";
static const char kGearJointType[] = "gear";
@@ -1258,6 +1259,29 @@ newJoint( lua_State *L )
result = CreateAndPushJoint( luaStateHandle, physics, jointDef );
}
+ else if (strcmp(kPistonJointV2Type, jointType) == 0)
+ {
+ b2Body* body1 = e1->GetBody();
+ b2Body* body2 = e2->GetBody();
+
+ Real px = luaL_torealphysics(L, 4, scale);
+ Real py = luaL_torealphysics(L, 5, scale);
+
+ // Don't scale the axis vector
+ Real axisX = luaL_toreal(L, 6);
+ Real axisY = luaL_toreal(L, 7);
+
+ b2PrismaticJointDefV2 jointDef;
+
+ b2Vec2 anchor(px, py);
+ b2Vec2 axis(axisX, axisY);
+ axis.Normalize();
+
+ jointDef.Initialize(body1, body2, anchor, axis);
+
+ result = CreateAndPushJoint(luaStateHandle, physics, jointDef);
+ }
+
else if ( strcmp( kFrictionJointType, jointType ) == 0 )
{
b2Body *body1 = e1->GetBody();
diff --git a/librtt/Rtt_PhysicsJoint.cpp b/librtt/Rtt_PhysicsJoint.cpp
index 363e20bdf..794ea04ae 100644
--- a/librtt/Rtt_PhysicsJoint.cpp
+++ b/librtt/Rtt_PhysicsJoint.cpp
@@ -103,6 +103,7 @@ ShouldGetLocalAnchor( b2JointType jointType )
case e_distanceJoint:
case e_revoluteJoint:
case e_prismaticJoint:
+ case e_prismaticJointV2:
case e_frictionJoint:
case e_wheelJoint:
case e_wheelJointV2:
@@ -150,6 +151,9 @@ GetLocalAnchorACallback( b2JointType jointType )
case e_prismaticJoint:
result = & GetLocalAnchorA< b2PrismaticJoint >;
break;
+ case e_prismaticJointV2:
+ result = &GetLocalAnchorA< b2PrismaticJointV2 >;
+ break;
case e_frictionJoint:
result = & GetLocalAnchorA< b2FrictionJoint >;
break;
@@ -189,6 +193,9 @@ GetLocalAnchorBCallback( b2JointType jointType )
case e_prismaticJoint:
result = & GetLocalAnchorB< b2PrismaticJoint >;
break;
+ case e_prismaticJointV2:
+ result = &GetLocalAnchorB< b2PrismaticJointV2 >;
+ break;
case e_frictionJoint:
result = & GetLocalAnchorB< b2FrictionJoint >;
break;
@@ -285,6 +292,7 @@ ShouldGetLocalAxis( b2JointType jointType )
switch ( jointType )
{
case e_prismaticJoint:
+ case e_prismaticJointV2:
case e_wheelJoint:
case e_wheelJointV2:
result = true;
@@ -317,8 +325,12 @@ GetLocalAxisACallback( b2JointType jointType )
case e_prismaticJoint:
result = & GetLocalAxisA< b2PrismaticJoint >;
break;
+ case e_prismaticJointV2:
+ result = &GetLocalAxisA< b2PrismaticJointV2 >;
+ break;
case e_wheelJoint:
result = & GetLocalAxisA< b2WheelJoint >;
+ break;
case e_wheelJointV2:
result = &GetLocalAxisA< b2WheelJointV2 >;
break;
@@ -440,7 +452,12 @@ PhysicsJoint::setLimits( lua_State *L )
b2WheelJointV2* joint = (b2WheelJointV2*)baseJoint;
joint->SetLimits(Rtt_RealToFloat(lowerLimit), Rtt_RealToFloat(upperLimit));
}
- else
+ else if (baseJoint->GetType() == e_prismaticJointV2)
+ {
+ b2PrismaticJointV2* joint = (b2PrismaticJointV2*)baseJoint;
+ joint->SetLimits(Rtt_RealToFloat(lowerLimit), Rtt_RealToFloat(upperLimit));
+ }
+ else if (baseJoint->GetType() == e_prismaticJoint)
{
b2PrismaticJoint* joint = (b2PrismaticJoint*)baseJoint;
joint->SetLimits(Rtt_RealToFloat(lowerLimit), Rtt_RealToFloat(upperLimit));
@@ -470,13 +487,20 @@ PhysicsJoint::getLimits( lua_State *L )
lowerLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetLowerLimit()), scale);
upperLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetUpperLimit()), scale);
}
- else
+ else if (baseJoint->GetType() == e_prismaticJoint)
{
b2PrismaticJoint* joint = (b2PrismaticJoint*)baseJoint; // assumption: this cast is OK for both cases (otherwise check type)
lowerLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetLowerLimit()), scale);
upperLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetUpperLimit()), scale);
}
+ else if (baseJoint->GetType() == e_prismaticJointV2)
+ {
+ b2PrismaticJointV2* joint = (b2PrismaticJointV2*)baseJoint; // assumption: this cast is OK for both cases (otherwise check type)
+
+ lowerLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetLowerLimit()), scale);
+ upperLimit = Rtt_RealMul(Rtt_FloatToReal(joint->GetUpperLimit()), scale);
+ }
lua_pushnumber( L, lowerLimit );
lua_pushnumber( L, upperLimit );
@@ -844,6 +868,76 @@ PhysicsJoint::ValueForKey( lua_State *L )
result = 0;
}
}
+ else if (jointType == e_prismaticJointV2)
+ {
+ //////////////////////////////////////////////////////////////////////////////
+ // This is exposed as a "piston" joint in Corona (aka "prismaticV2" in Box2D terms)
+
+ b2PrismaticJointV2* joint = (b2PrismaticJointV2*)baseJoint;
+
+ if (0 == strcmp("isMotorEnabled", key))
+ {
+ lua_pushboolean(L, joint->IsMotorEnabled());
+ }
+ else if (0 == strcmp("motorSpeed", key))
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetMotorSpeed()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("motorForce", key)) // read-only
+ {
+ Runtime& runtime = *LuaContext::GetRuntime(L);
+ float32 inverseDeltaTime = (float)runtime.GetFPS();
+
+ lua_pushnumber(L, joint->GetMotorForce(inverseDeltaTime));
+ }
+ else if (0 == strcmp("maxMotorForce", key))
+ {
+ lua_pushnumber(L, joint->GetMaxMotorForce());
+ }
+ else if (strcmp("getLocalAxisA", key) == 0)
+ {
+ lua_pushlightuserdata(L, (void*)GetLocalAxisACallback(e_prismaticJoint));
+ lua_pushcclosure(L, Self::getLocalAxis, 1);
+ }
+ else if (0 == strcmp("referenceAngle", key)) // read-only
+ {
+ Rtt_Real valueDegrees = Rtt_RealRadiansToDegrees(Rtt_FloatToReal(joint->GetReferenceAngle()));
+ lua_pushnumber(L, valueDegrees);
+ }
+ else if (0 == strcmp("jointTranslation", key)) // read-only
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetJointTranslation()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("jointSpeed", key)) // read-only
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Rtt_Real valuePixels = Rtt_RealMul(Rtt_FloatToReal(joint->GetJointSpeed()), scale);
+ lua_pushnumber(L, valuePixels);
+ }
+ else if (0 == strcmp("isLimitEnabled", key))
+ {
+ lua_pushboolean(L, joint->IsLimitEnabled());
+ }
+ else if (strcmp("setLimits", key) == 0)
+ {
+ lua_pushcfunction(L, Self::setLimits);
+ }
+ else if (strcmp("getLimits", key) == 0)
+ {
+ lua_pushcfunction(L, Self::getLimits);
+ }
+ else
+ {
+ result = 0;
+ }
+ }
else if ( jointType == e_frictionJoint )
{
//////////////////////////////////////////////////////////////////////////////
@@ -1313,6 +1407,59 @@ PhysicsJoint::SetValueForKey( lua_State *L )
}
}
+
+ else if (jointType == e_prismaticJointV2)
+ {
+ //////////////////////////////////////////////////////////////////////////////
+ // This is exposed as a "piston" joint in Corona (aka "prismatic" in Box2D terms)
+
+ b2PrismaticJointV2* joint = (b2PrismaticJointV2*)baseJoint;
+
+ if (0 == strcmp("isMotorEnabled", key))
+ {
+ if (lua_isboolean(L, 3))
+ {
+ joint->EnableMotor(lua_toboolean(L, 3));
+ }
+ }
+ else if (0 == strcmp("motorSpeed", key))
+ {
+ if (lua_isnumber(L, 3))
+ {
+ const PhysicsWorld& physics = LuaContext::GetRuntime(L)->GetPhysicsWorld();
+ Real scale = physics.GetPixelsPerMeter();
+ Real valueMeters = Rtt_RealDiv(luaL_toreal(L, 3), scale);
+ joint->SetMotorSpeed(Rtt_RealToFloat(valueMeters));
+ }
+ }
+ else if (0 == strcmp("motorForce", key))
+ {
+ // No-op for read-only property
+ }
+ else if (0 == strcmp("maxMotorForce", key))
+ {
+ if (lua_isnumber(L, 3))
+ {
+ joint->SetMaxMotorForce(lua_tonumber(L, 3));
+ }
+ }
+ else if (0 == strcmp("isLimitEnabled", key))
+ {
+ if (lua_isboolean(L, 3))
+ {
+ joint->EnableLimit(lua_toboolean(L, 3));
+ }
+ }
+ else if (0 == strcmp("jointTranslation", key))
+ {
+ // No-op for read-only property
+ }
+ else if (0 == strcmp("jointSpeed", key))
+ {
+ // No-op for read-only property
+ }
+
+ }
else if ( jointType == e_frictionJoint )
{
From 8b5adc3d7da7878ebb68dd0333c58c69a6d44fb9 Mon Sep 17 00:00:00 2001
From: Kan <70838508+kan6868@users.noreply.github.com>
Date: Thu, 10 Jul 2025 21:11:09 +0700
Subject: [PATCH 5/6] Revert "Add b2PrismaticJointV2 to build list
android/window/html/linux"
This reverts commit ab9a0fb2b432fb2acf48f859b4778f0c4b4e0682.
---
external/Box2D | 2 +-
platform/android/ndk/CMakeLists.txt | 1 -
platform/emscripten/gmake/Box2D.make | 5 -----
platform/linux/CMakeList.txt | 1 -
platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj | 2 --
.../Box2D.Library/Box2D.Library.Win32.vcxproj.filters | 6 ------
6 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/external/Box2D b/external/Box2D
index a32b63b57..c7ac8556d 160000
--- a/external/Box2D
+++ b/external/Box2D
@@ -1 +1 @@
-Subproject commit a32b63b5754e34f8f31188e48a35e37330c8317d
+Subproject commit c7ac8556d8d6834ec187820dbfdfa311c655ba6b
diff --git a/platform/android/ndk/CMakeLists.txt b/platform/android/ndk/CMakeLists.txt
index 9368d98d4..c99993741 100644
--- a/platform/android/ndk/CMakeLists.txt
+++ b/platform/android/ndk/CMakeLists.txt
@@ -717,7 +717,6 @@ add_library( corona SHARED
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MouseJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
- ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
diff --git a/platform/emscripten/gmake/Box2D.make b/platform/emscripten/gmake/Box2D.make
index 381063f00..8d040477f 100644
--- a/platform/emscripten/gmake/Box2D.make
+++ b/platform/emscripten/gmake/Box2D.make
@@ -110,7 +110,6 @@ OBJECTS := \
$(OBJDIR)/b2MotorJoint.o \
$(OBJDIR)/b2MouseJoint.o \
$(OBJDIR)/b2PrismaticJoint.o \
- $(OBJDIR)/b2PrismaticJointV2.o \
$(OBJDIR)/b2PulleyJoint.o \
$(OBJDIR)/b2RevoluteJoint.o \
$(OBJDIR)/b2RopeJoint.o \
@@ -350,10 +349,6 @@ $(OBJDIR)/b2PrismaticJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2Pr
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
-$(OBJDIR)/b2PrismaticJointV2.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
- @echo $(notdir $<)
- $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
-
$(OBJDIR)/b2PulleyJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
diff --git a/platform/linux/CMakeList.txt b/platform/linux/CMakeList.txt
index c0058c487..0a18d39d4 100644
--- a/platform/linux/CMakeList.txt
+++ b/platform/linux/CMakeList.txt
@@ -779,7 +779,6 @@ SET( SOLAR2D_SOURCES
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MouseJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
- ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
index 96071a224..c4c495404 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
@@ -62,7 +62,6 @@
-
@@ -121,7 +120,6 @@
-
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
index 432cd1010..cca5b802a 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
@@ -179,9 +179,6 @@
Dynamics\Joints
-
- Dynamics\Joints
-
@@ -375,8 +372,5 @@
Dynamics\Joints
-
- Dynamics\Joints
-
\ No newline at end of file
From f91d084a72045924cc7114544cd1d7f4338cbc21 Mon Sep 17 00:00:00 2001
From: Kan <70838508+kan6868@users.noreply.github.com>
Date: Thu, 10 Jul 2025 22:13:48 +0700
Subject: [PATCH 6/6] Add b2PrismaticJointV2 to build list
---
platform/android/ndk/CMakeLists.txt | 1 +
platform/emscripten/gmake/Box2D.make | 5 +++++
platform/linux/CMakeList.txt | 1 +
platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj | 2 ++
.../Box2D.Library/Box2D.Library.Win32.vcxproj.filters | 6 ++++++
5 files changed, 15 insertions(+)
diff --git a/platform/android/ndk/CMakeLists.txt b/platform/android/ndk/CMakeLists.txt
index c99993741..9368d98d4 100644
--- a/platform/android/ndk/CMakeLists.txt
+++ b/platform/android/ndk/CMakeLists.txt
@@ -717,6 +717,7 @@ add_library( corona SHARED
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MouseJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
+ ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
diff --git a/platform/emscripten/gmake/Box2D.make b/platform/emscripten/gmake/Box2D.make
index 8d040477f..381063f00 100644
--- a/platform/emscripten/gmake/Box2D.make
+++ b/platform/emscripten/gmake/Box2D.make
@@ -110,6 +110,7 @@ OBJECTS := \
$(OBJDIR)/b2MotorJoint.o \
$(OBJDIR)/b2MouseJoint.o \
$(OBJDIR)/b2PrismaticJoint.o \
+ $(OBJDIR)/b2PrismaticJointV2.o \
$(OBJDIR)/b2PulleyJoint.o \
$(OBJDIR)/b2RevoluteJoint.o \
$(OBJDIR)/b2RopeJoint.o \
@@ -349,6 +350,10 @@ $(OBJDIR)/b2PrismaticJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2Pr
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+$(OBJDIR)/b2PrismaticJointV2.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
+ @echo $(notdir $<)
+ $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
+
$(OBJDIR)/b2PulleyJoint.o: ../../../external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<"
diff --git a/platform/linux/CMakeList.txt b/platform/linux/CMakeList.txt
index 0a18d39d4..c0058c487 100644
--- a/platform/linux/CMakeList.txt
+++ b/platform/linux/CMakeList.txt
@@ -779,6 +779,7 @@ SET( SOLAR2D_SOURCES
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2MouseJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
+ ${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PrismaticJointV2.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
${CORONA_ROOT}/external/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
index c4c495404..96071a224 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj
@@ -62,6 +62,7 @@
+
@@ -120,6 +121,7 @@
+
diff --git a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
index cca5b802a..b0ab439d6 100644
--- a/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
+++ b/platform/windows/Box2D.Library/Box2D.Library.Win32.vcxproj.filters
@@ -179,6 +179,9 @@
Dynamics\Joints
+
+ Dynamics
+
@@ -372,5 +375,8 @@
Dynamics\Joints
+
+ Dynamics
+
\ No newline at end of file