Skip to content

Commit

Permalink
library: various tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jun 18, 2024
1 parent fef0035 commit 3f11662
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public Vector3f getHalfExtents(Vector3f storeResult) {
* Instantiate the configured {@code BoxShape}.
*/
private void createShape() {
assert MyVector3f.isAllNonNegative(halfExtents) : halfExtents;

MemorySession arena = PhysicsSpace.getArena();
FVec3 vec3
= FVec3.of(arena, halfExtents.x, halfExtents.y, halfExtents.z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Shape getJoltShape() {
protected void setNativeObject(Shape joltShape) {
Validate.nonNull(joltShape, "jolt shape");

assert this.joltShape == null : joltShape;
assert this.joltShape == null : this.joltShape;
this.joltShape = joltShape;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public boolean canScale(Vector3f scale) {
private void createShape() {
assert radius >= 0f : radius;

MemorySession arena = PhysicsSpace.getArena();
SphereShapeSettings bss = SphereShapeSettings.of(radius);
MemorySession arena = PhysicsSpace.getArena();
Shape shape = Jolt.use(bss, settings -> {
return settings.create(arena);
}).orThrow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ public float getMass() {
*/
@Override
public void setPhysicsLocation(Vector3f location) {
Validate.finite(location, "location");

Quaternion orientation = getPhysicsRotation(null);
reposition(location, orientation);
}
Expand Down

0 comments on commit 3f11662

Please sign in to comment.