Skip to content

Commit

Permalink
MassProperties: modify the return types of 2 setters, to allow chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Sep 23, 2024
1 parent c0a675d commit 569b80c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/github/stephengold/joltjni/MassProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,27 @@ public void scaleToMass(float mass) {
* Alter the inertia tensor. (native attribute: mIntertia)
*
* @param inertia the desired value (not null, unaffected, default=zero)
* @return the modified properties (for chaining)
*/
public void setInertia(Mat44Arg inertia) {
public MassProperties setInertia(Mat44Arg inertia) {
long propertiesVa = va();
long matrixVa = inertia.va();
setInertia(propertiesVa, matrixVa);

return this;
}

/**
* Alter the mass. (native attribute: mMass)
*
* @param mass the desired mass (in kilograms, ≥0, default=0)
* @return the modified properties (for chaining)
*/
public void setMass(float mass) {
public MassProperties setMass(float mass) {
long propertiesVa = va();
setMass(propertiesVa, mass);

return this;
}

/**
Expand Down

0 comments on commit 569b80c

Please sign in to comment.