diff --git a/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloLibbulletjme.java b/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloLibbulletjme.java index e8024fdd..c5e27a0f 100644 --- a/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloLibbulletjme.java +++ b/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloLibbulletjme.java @@ -63,17 +63,20 @@ private HelloLibbulletjme() { */ public static void main(String[] arguments) { // Load a native library from ~/Downloads directory. + boolean dist = true; // use distribution filenames String homePath = System.getProperty("user.home"); File downloadDirectory = new File(homePath, "Downloads"); + String buildType = "Release"; + String flavor = "Sp"; NativeLibraryLoader.loadLibbulletjme( - true, downloadDirectory, "Release", "Sp"); + dist, downloadDirectory, buildType, flavor); physicsSpace = createSpace(); populateSpace(); float timeStep = 0.02f; Vector3f location = new Vector3f(); - for (int i = 0; i < 50; ++i) { + for (int iteration = 0; iteration < 50; ++iteration) { updatePhysics(timeStep); ball.getPhysicsLocation(location); @@ -118,7 +121,7 @@ private static void populateSpace() { * @param intervalSeconds the time step to simulate (in seconds, ≥0) */ private static void updatePhysics(float intervalSeconds) { - int maxSteps = 0; + int maxSteps = 0; // for a single step of the specified duration physicsSpace.update(intervalSeconds, maxSteps); } } diff --git a/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloVehicle0.java b/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloVehicle0.java index 5c53aa05..aa4c83d1 100644 --- a/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloVehicle0.java +++ b/apps/src/main/java/com/github/stephengold/lbjexamples/apps/console/HelloVehicle0.java @@ -63,10 +63,13 @@ private HelloVehicle0() { */ public static void main(String[] arguments) { // Load a native library from ~/Downloads directory. + boolean dist = true; // use distribution filenames String homePath = System.getProperty("user.home"); File downloadDirectory = new File(homePath, "Downloads"); + String buildType = "Release"; + String flavor = "Sp"; NativeLibraryLoader.loadLibbulletjme( - true, downloadDirectory, "Release", "Sp"); + dist, downloadDirectory, buildType, flavor); // Create a PhysicsSpace using DBVT for broadphase. PhysicsSpace.BroadphaseType bPhase = PhysicsSpace.BroadphaseType.DBVT; @@ -131,9 +134,10 @@ public static void main(String[] arguments) { // 150 iterations with a 16.7-msec timestep float timeStep = 1 / 60f; + int maxSteps = 0; // for a single step of the specified duration Vector3f location = new Vector3f(); - for (int i = 0; i < 150; ++i) { - physicsSpace.update(timeStep, 0); + for (int iteration = 0; iteration < 150; ++iteration) { + physicsSpace.update(timeStep, maxSteps); vehicle.getPhysicsLocation(location); System.out.println(location); } diff --git a/docs/en/modules/ROOT/pages/add.adoc b/docs/en/modules/ROOT/pages/add.adoc index 8dd83838..86d1aae9 100644 --- a/docs/en/modules/ROOT/pages/add.adoc +++ b/docs/en/modules/ROOT/pages/add.adoc @@ -162,7 +162,8 @@ To simulate a single 20-millisecond step: [source,java] ---- float timeStep = 0.02f; // in seconds -physicsSpace.update(timeStep, 0); +int maxSteps = 0; // for a single step of the specified duration +physicsSpace.update(timeStep, maxSteps); ---- In real-time simulation, the interval between updates will vary. diff --git a/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloLibbulletjme.kt b/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloLibbulletjme.kt index d8c3c657..353d598b 100644 --- a/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloLibbulletjme.kt +++ b/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloLibbulletjme.kt @@ -54,16 +54,19 @@ private var physicsSpace: PhysicsSpace? = null */ fun main() { // Load a native library from ~/Downloads directory. + val dist = true // use distribution filenames val homePath = System.getProperty("user.home") - val downloadDirectory = File(homePath, "Downloads") + val downloadDirectory = new File(homePath, "Downloads") + val buildType = "Release" + val flavor = "Sp" NativeLibraryLoader.loadLibbulletjme( - true, downloadDirectory, "Release", "Sp") + dist, downloadDirectory, buildType, flavor) physicsSpace = createSpace() populateSpace() val location = Vector3f() - for (i in 0 ..< 50) { + for (iteration in 0 ..< 50) { updatePhysics(intervalSeconds = 0.02f) ball!!.getPhysicsLocation(location) @@ -103,6 +106,6 @@ private fun populateSpace() { * intervalSeconds: the time step to simulate (in seconds, >=0) */ private fun updatePhysics(intervalSeconds : Float) { - val maxSteps = 0 + val maxSteps = 0 // for a single step of the specified duration physicsSpace!!.update(intervalSeconds, maxSteps) } \ No newline at end of file diff --git a/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloVehicle0.kt b/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloVehicle0.kt index d02d5727..97eaeea1 100644 --- a/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloVehicle0.kt +++ b/kotlin-apps/src/main/kotlin/com/github/stephengold/lbjexamples/ktapps/console/HelloVehicle0.kt @@ -54,15 +54,18 @@ import java.util.Collection */ fun main() { // Load a native library from ~/Downloads directory. + val dist = true // use distribution filenames val homePath = System.getProperty("user.home") - val downloadDirectory = File(homePath, "Downloads") + val downloadDirectory = new File(homePath, "Downloads") + val buildType = "Release" + val flavor = "Sp" NativeLibraryLoader.loadLibbulletjme( - true, downloadDirectory, "Release", "Sp") + dist, downloadDirectory, buildType, flavor) // Create a PhysicsSpace using DBVT for broadphase. val physicsSpace = PhysicsSpace(PhysicsSpace.BroadphaseType.DBVT) - - // Add a horizontal plane at y=-0.65 to represent the ground. + + // Add a static horizontal plane at y=-0.65 to represent the ground. val groundY = -0.65f val plane = Plane(Vector3f.UNIT_Y, groundY) val planeShape = PlaneCollisionShape(plane) @@ -120,9 +123,9 @@ fun main() { // 150 iterations with a 16.7-msec timestep val timeStep = 1 / 60f - val maxSteps = 0 + val maxSteps = 0 // for a single step of the specified duration val location = Vector3f() - for (i in 0 ..< 150) { + for (iteration in 0 ..< 150) { physicsSpace.update(timeStep, maxSteps) vehicle.getPhysicsLocation(location) println(location)