Skip to content

Commit

Permalink
Rename get/setEnabledAxes to get/setDegreesOfFreedom;
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbytes committed May 27, 2024
1 parent 30352ee commit 8a02def
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dev
- Add `World:collideShape`.
- Add `Collider:get/setGravityScale`.
- Add `Collider:is/setContinuous`.
- Add `Collider:get/setEnabledAxes`.
- Add `Collider:get/setDegreesOfFreedom`.
- Add `Collider:applyLinearImpulse` and `Collider:applyAngularImpulse`.
- Add `Collider:getRawPosition` and `Collider:getRawOrientation`.
- Add `Collider:getShape`.
Expand Down
12 changes: 6 additions & 6 deletions src/api/l_physics_collider.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ static int l_lovrColliderResetMassData(lua_State* L) {
return 0;
}

static int l_lovrColliderGetEnabledAxes(lua_State* L) {
static int l_lovrColliderGetDegreesOfFreedom(lua_State* L) {
Collider* collider = luax_checkcollider(L, 1);
bool translation[3];
bool rotation[3];
lovrColliderGetEnabledAxes(collider, translation, rotation);
lovrColliderGetDegreesOfFreedom(collider, translation, rotation);

char string[3];
size_t length;
Expand All @@ -295,7 +295,7 @@ static int l_lovrColliderGetEnabledAxes(lua_State* L) {
return 2;
}

static int l_lovrColliderSetEnabledAxes(lua_State* L) {
static int l_lovrColliderSetDegreesOfFreedom(lua_State* L) {
Collider* collider = luax_checkcollider(L, 1);
bool translation[3] = { false, false, false };
bool rotation[3] = { false, false, false };
Expand All @@ -316,7 +316,7 @@ static int l_lovrColliderSetEnabledAxes(lua_State* L) {
}
}

lovrColliderSetEnabledAxes(collider, translation, rotation);
lovrColliderSetDegreesOfFreedom(collider, translation, rotation);
return 0;
}

Expand Down Expand Up @@ -693,8 +693,8 @@ const luaL_Reg lovrCollider[] = {
{ "getAutomaticMass", l_lovrColliderGetAutomaticMass },
{ "setAutomaticMass", l_lovrColliderSetAutomaticMass },
{ "resetMassData", l_lovrColliderResetMassData },
{ "getEnabledAxes", l_lovrColliderGetEnabledAxes },
{ "setEnabledAxes", l_lovrColliderSetEnabledAxes },
{ "getDegreesOfFreedom", l_lovrColliderGetDegreesOfFreedom },
{ "setDegreesOfFreedom", l_lovrColliderSetDegreesOfFreedom },
{ "getPosition", l_lovrColliderGetPosition },
{ "setPosition", l_lovrColliderSetPosition },
{ "getOrientation", l_lovrColliderGetOrientation },
Expand Down
4 changes: 2 additions & 2 deletions src/modules/physics/physics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ void lovrColliderResetMassData(Collider* collider) {
}
}

void lovrColliderGetEnabledAxes(Collider* collider, bool translation[3], bool rotation[3]) {
void lovrColliderGetDegreesOfFreedom(Collider* collider, bool translation[3], bool rotation[3]) {
JPH_MotionProperties* motion = JPH_Body_GetMotionProperties(collider->body);
JPH_AllowedDOFs dofs = JPH_MotionProperties_GetAllowedDOFs(motion);
if (dofs & JPH_AllowedDOFs_TranslationX) translation[0] = true;
Expand All @@ -1387,7 +1387,7 @@ void lovrColliderGetEnabledAxes(Collider* collider, bool translation[3], bool ro
if (dofs & JPH_AllowedDOFs_RotationZ) rotation[2] = true;
}

void lovrColliderSetEnabledAxes(Collider* collider, bool translation[3], bool rotation[3]) {
void lovrColliderSetDegreesOfFreedom(Collider* collider, bool translation[3], bool rotation[3]) {
JPH_AllowedDOFs dofs = 0;

if (translation[0]) dofs |= JPH_AllowedDOFs_TranslationX;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/physics/physics.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ void lovrColliderSetCenterOfMass(Collider* collider, float center[3]);
bool lovrColliderGetAutomaticMass(Collider* collider);
void lovrColliderSetAutomaticMass(Collider* collider, bool enable);
void lovrColliderResetMassData(Collider* collider);
void lovrColliderGetEnabledAxes(Collider* collider, bool translation[3], bool rotation[3]);
void lovrColliderSetEnabledAxes(Collider* collider, bool translation[3], bool rotation[3]);
void lovrColliderGetDegreesOfFreedom(Collider* collider, bool translation[3], bool rotation[3]);
void lovrColliderSetDegreesOfFreedom(Collider* collider, bool translation[3], bool rotation[3]);
void lovrColliderGetPosition(Collider* collider, float position[3]);
void lovrColliderSetPosition(Collider* collider, float position[3]);
void lovrColliderGetOrientation(Collider* collider, float orientation[4]);
Expand Down

0 comments on commit 8a02def

Please sign in to comment.