Skip to content

Commit

Permalink
CustomConvexShape: add a 3-argument constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jan 22, 2024
1 parent 1384cef commit 9ca4a10
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ protected Vector3f initialValue() {
// *************************************************************************
// constructors

/**
* Instantiate a custom collision shape with the specified extents. Subclass
* constructors should also invoke {@code setScaledInertia()}.
*
* @param xHalfExtent the desired half extent on the local X axis, for
* scale=(1,1,1) and margin=0 (>0)
* @param yHalfExtent the desired half extent on the local Y axis, for
* scale=(1,1,1) and margin=0 (>0)
* @param zHalfExtent the desired half extent on the local Z axis, for
* scale=(1,1,1) and margin=0 (>0)
*/
protected CustomConvexShape(
float xHalfExtent, float yHalfExtent, float zHalfExtent) {
Validate.positive(xHalfExtent, "X half extent");
Validate.positive(yHalfExtent, "Y half extent");
Validate.positive(zHalfExtent, "Z half extent");

this.halfExtents = new Vector3f(xHalfExtent, yHalfExtent, zHalfExtent);
createShape();
}

/**
* Instantiate a custom collision shape with the specified extents. Subclass
* constructors should also invoke {@code setScaledInertia()}.
Expand Down

0 comments on commit 9ca4a10

Please sign in to comment.