GithubHelp home page GithubHelp logo

stephengold / minie Goto Github PK

View Code? Open in Web Editor NEW
119.0 19.0 21.0 116.81 MB

Integrate Bullet Physics and V-HACD into jMonkeyEngine projects. (code has New BSD license)

Home Page: https://stephengold.github.io/Minie/minie/overview.html

License: Other

Java 99.96% Shell 0.04%
jmonkeyengine3 jme3 animation inverse-kinematics bullet-physics ragdoll physics-3d soft-bodies collision-shape physics-simulation

minie's People

Contributors

dependabot[bot] avatar duncanj avatar stephengold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minie's Issues

switch to Bullet v3

Currently, Minie uses a private fork of Bullet v2.89, which was released in 2019. Erwin Coumans released v3.06 on 14 September 2020 and v3.07 on 26 November 2020.

At some point, Minie should switch from Bullet v2 to Bullet v3. However, I want to wait until it's clear that v3 is superior. A key indication would be when development of v2 ceases. Given that btMultiBody.h was modified on 24 November 2020, I'm still hopeful that there may be a v2.90 of Bullet.

Minie doesn't work with jMonkeyEngine SDK v3.3.0-stable on Windows 10

The fix is to use Gradle 6.7, not 7.4 as used by Minie. Details follow:

Running jMonkeyEngine SDK v3.3.0-stable on Windows 10.
Downloaded Minie-4.8.0-source from website, and via gradle.
Minie built OK.
Opened Minie-4.8.0 projects in SDK, they appeared as Gradle Builds..
Got the following error for all subprojects, and the subprojects wouldn't open:

groovy.lang.MissingPropertyException: Could not get unknown property 'compileConfigurationName' for source set 'main' of type org.gradle.api.internal.tasks.DefaultSourceSet.

Researched using google, found a problem reported with Netbeans and gradle:

https://stackoverflow.com/questions/67635885/spring-initializr-gradle-project-fails-unknown-property-compileconfigurationnam
Which identified a known problem: "Gradle 7.0 is not supported in NetBeans 12.3".

I've no idea what version of netbeans the JME SDK uses, but Minie uses gradle v7.4.

Fix:
Installed gradle-6.7 on my PC
cd into the Minie build: cd Minie\gradle\wrapper
Enter command: .\gradle wrapper
This updated the version of gradle in Minie.
The wrapper changed to gradle-6.7.

Re-Opened Minie-4.8.0 projects in the SDK.
Minie project built OK, and the SDK errors had gone.
Some examples ran OK.

Minie for jme 3.3

Is it possible to have Minie in 3.3. beta? I tried the following:

MonkeyEngine SDK 3.3.0-v3.3.0-beta1-sdk1-SNAPSHOT Java: 11.0.6; OpenJDK 64-Bit Server VM 11.0.6+10
I cloned Minie 14xfor33, possibly I should have tried root anyway. Then I followed the instructions until it turned out that there is nothing in Minie/subprojects. I tried to build Minie anyway:

JAVA_HOME="/home/local/jmonkeyplatform/jdk"
cd /home/local/Minie; ./gradlew --configure-on-demand -x check clean build
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • Where:
    Script '/home/local/Minie/MinieLibrary/build.gradle' line: 33

  • What went wrong:
    A problem occurred evaluating project ':MinieLibrary'.

Could not set unknown property 'archiveBaseName' for task ':MinieLibrary:jar' of type org.gradle.api.tasks.bundling.Jar.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 9s

soft-body access violations with Java 9+ on Windows

Hi Stephen,
Just followed your very good installation instructions,
and using a gradle build tried running your Examples.

HelloCloth.java and HelloPin.java both crash as follows:

#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe477b58bc, pid=10304, tid=0x0000000000000c5c
#
# JRE version: OpenJDK Runtime Environment (8.0_212-b04) (build 1.8.0_212-b04)
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [bulletjme.dll+0x1358bc]

If the line below is commented out then both the (quite impressive) examples work:
//tharg mat.setAngularStiffness(0f); // default=1

Regards,
Tom.

Environment:
Product Version: jMonkeyEngine SDK v3.2.4-stable-sdk1
Updates: jMonkeyEngine SDK is updated to version NetBeans 8.2 Patch 2
Java: 1.8.0_212; OpenJDK 64-Bit Server VM 25.212-b04
Runtime: OpenJDK Runtime Environment 1.8.0_212-b04
System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (jmonkeyplatform)
User directory: C:\Users\tom_h\AppData\Roaming.jmonkeyplatform\v3.2.4-stable-sdk1
Cache directory: C:\Users\tom_h\AppData\Roaming.jmonkeyplatform\v3.2.4-stable-sdk1\var\cache

Exception thrown upon BulletAppState creation

I am switching from the c++ native bullet physics engine to Minie for my game. But when I try to create a new BulletAppState, an exception is thrown:

Uncaught exception thrown in Thread[jME3 Main,5,main]
NoClassDefFoundError: jme3utilities/Validate

Here is my code:

@OverRide
public void simpleInitApp() {
BulletAppState bas = new BulletAppState();
stateManager.attach(bas);
PhysicsSpace physicsSpace = bas.getPhysicsSpace();
}

Creating the BulletAppState did work when I used the old physics engine. And I've done everything the included README file said to do. If you do know something I could try, please let me know.

About Half the Examples I tried crashed at bulletjme.dll+0x79570

I just downloaded Minie to a Windows 10 system.
About 50% of the examples failed with the same error, at bulletjme.dll+0x79570:

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffea6b09570, pid=11868, tid=13056
#
# JRE version: OpenJDK Runtime Environment (11.0.6+10) (build 11.0.6+10)
# Java VM: OpenJDK 64-Bit Server VM (11.0.6+10, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [bulletjme.dll+0x79570]

For example:
TestSoftBody crashed at startup.
ConveyorDemo crashed when the block landed on the conveyor.
TestSoftBodyControl worked fine.

I repeated these test runs using a clean build, using the supplied MinieExamples.bat script in distributions.
I got the same crashes using Java runtime 1.8.9_301, SDK 8.0_301, SDK 11.0.6
This is the output from ConveyorDemo:

C:\Users\tom_h\Desktop\MinieExamples\bin>MinieExamples.bat
Libbulletjme version 14.1.0 initializing
Mar 28, 2022 2:08:21 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping "ScreenShot" twice to trigger.
C:\Users\tom_h\Desktop\MinieExamples\bin>MinieExamples.bat
Libbulletjme version 14.1.0 initializing
Mar 28, 2022 2:09:36 PM com.jme3.input.InputManager addMapping
WARNING: Attempted to add mapping "ScreenShot" twice to trigger.
Mar 28, 2022 2:09:36 PM jme3utilities.SignalTracker test
WARNING: Testing a signal which has not yet been added: "orbitLeft".
Mar 28, 2022 2:09:36 PM jme3utilities.SignalTracker test
WARNING: Testing a signal which has not yet been added: "orbitRight".
[ALL OK UNTIL I PRESS SPACE BAR, THE BLOCK DROPPED AND THE APP CRASHED]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffea1d89570, pid=11120, tid=0x000000000000217c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_301-b09) (build 1.8.0_301-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.301-b09 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [bulletjme.dll+0x79570]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\tom_h\Desktop\MinieExamples\bin\hs_err_pid11120.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Armature assigned but no weights elements cause IllegalStateException

Hello, one issue was most annoy for me, because just without DAC, JME 3.3 animations were working properly. When add DAC where Armature have assigned geometries, but this geometries have no weights, it cause issue:

mar 14, 2020 9:56:14 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[main,5,main]
java.lang.IllegalStateException: Max weights per vert is incorrectly set!
at com.jme3.anim.SkinningControl.applySkinning(SkinningControl.java:464)
at com.jme3.anim.SkinningControl.softwareSkinUpdate(SkinningControl.java:446)
at com.jme3.anim.SkinningControl.controlRenderSoftware(SkinningControl.java:263)
at com.jme3.anim.SkinningControl.controlRender(SkinningControl.java:303)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:118)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:757)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:721)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:731)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:710)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1096)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1158)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:270)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:503)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:585)
at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:427)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:463)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at test.TestCharacterAnimationAndshader.main(TestCharacterAnimationAndshader.java:48)

here is example code that cause issue when using DAC control:

        Spatial body = ((Node) app.getAssetManager().loadModel("Models/game/character/body/body.gltf"));
        Spatial hair = ((Node) app.getAssetManager().loadModel("Models/game/character/hair/hair.gltf"));
        Spatial clothes = ((Node) app.getAssetManager().loadModel("Models/game/character/clothes/clothes.gltf"));
        Node model = new Node();
        model.attachChild(body);
        SceneGraphVisitor visitor = new SceneGraphVisitor() {
            @Override
            public void visit(Spatial spatTraversal) {
                if(!spatTraversal.getName().equals("Armature")){
                    ((Node)model.getChild("Armature")).attachChild(spatTraversal);
                }
            }
        };
        ((Node)hair).breadthFirstTraversal(visitor);
        ((Node)clothes).breadthFirstTraversal(visitor);

when i comment breadthFirstTraversal lines, it works. With them it dont because it looks like hairs/clothes i have no weights, but JME 3.3 animations skip them and work properly, while DAC throw issue.

I think DAC should skip no weights element, same as JME 3.3 animations do :)

JVM crash while loading a scaled MeshCollisionShape

Prior discussion: https://hub.jmonkeyengine.org/t/jvm-crash-in-stranded/47354/27

I reproduced the crash on Linux using DebugSp natives and the "pc-screen.gltf" model. Here is a native stack trace from GDB:

#0  0x000070d6e48da4a1 in btQuantizedBvh::reportAabbOverlappingNodex (
    this=0x0, nodeCallback=0x70d6e4dfc5d0, aabbMin=..., aabbMax=...)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp:323
#1  0x000070d6e46dbc49 in btBvhTriangleMeshShape::processAllTriangles (
    this=0x70d654101db0, callback=0x70d6e4dfc6f0, aabbMin=..., aabbMax=...)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp:326
#2  0x000070d6e4684cf1 in btTriangleMeshShape::localGetSupportingVertex (
    this=0x70d654101db0, vec=...)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp:174
#3  0x000070d6e4684868 in btTriangleMeshShape::recalcLocalAabb (
    this=0x70d654101db0)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp:62
#4  0x000070d6e46849e5 in btTriangleMeshShape::setLocalScaling (
    this=0x70d654101db0, scaling=...)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp:115
#5  0x000070d6e46dbd17 in btBvhTriangleMeshShape::setLocalScaling (
    this=0x70d654101db0, scaling=...)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp:335
#6  0x000070d6e4829936 in Java_com_jme3_bullet_collision_shapes_CollisionShape_setLocalScaling (pEnv=0x70d71c4b4290, shapeId=124065835654576, scaleVector=0x70d6e4dfc948) at /home/travis/build/stephengold/Libbulletjme/src/main/native/glue/com_jme3_bullet_collision_shapes_CollisionShape.cpp:255

And here's the Java stack from the crash log:

j  com.jme3.bullet.collision.shapes.CollisionShape.setLocalScaling(JLcom/jme3/math/Vector3f;)V+0
j  com.jme3.bullet.collision.shapes.CollisionShape.setScale(Lcom/jme3/math/Vector3f;)V+84
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.setScale(Lcom/jme3/math/Vector3f;)V+2
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.createShape()V+181
j  com.jme3.bullet.collision.shapes.MeshCollisionShape.read(Lcom/jme3/export/JmeImporter;)V+113
j  com.jme3.export.binary.BinaryImporter.readObject(I)Lcom/jme3/export/Savable;+203
j  com.jme3.export.binary.BinaryInputCapsule.readSavable(Ljava/lang/String;Lcom/jme3/export/Savable;)Lcom/jme3/export/Savable;+81
j  com.jme3.bullet.collision.shapes.infos.ChildCollisionShape.read(Lcom/jme3/export/JmeImporter;)V+64
j  com.jme3.export.binary.BinaryImporter.readObject(I)Lcom/jme3/export/Savable;+203
j  com.jme3.export.binary.BinaryInputCapsule.resolveIDs([Ljava/lang/Object;)[Lcom/jme3/export/Savable;+42
j  com.jme3.export.binary.BinaryInputCapsule.readSavableArray(Ljava/lang/String;[Lcom/jme3/export/Savable;)[Lcom/jme3/export/Savable;+68
j  com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(Ljava/lang/String;Ljava/util/ArrayList;)Ljava/util/ArrayList;+65
j  com.jme3.bullet.collision.shapes.CompoundCollisionShape.read(Lcom/jme3/export/JmeImporter;)V+19
j  com.jme3.export.binary.BinaryImporter.readObject(I)Lcom/jme3/export/Savable;+203
j  com.jme3.export.binary.BinaryInputCapsule.resolveIDs([Ljava/lang/Object;)[Lcom/jme3/export/Savable;+42
j  com.jme3.export.binary.BinaryInputCapsule.readStringSavableMap(Ljava/lang/String;Ljava/util/Map;)Ljava/util/Map;+75
j  com.jme3.scene.Spatial.read(Lcom/jme3/export/JmeImporter;)V+250
j  com.jme3.scene.Node.read(Lcom/jme3/export/JmeImporter;)V+79
j  com.jme3.export.binary.BinaryImporter.readObject(I)Lcom/jme3/export/Savable;+203
j  com.jme3.export.binary.BinaryImporter.load(Ljava/io/InputStream;Lcom/jme3/export/ReadListener;Ljava/io/ByteArrayOutputStream;)Lcom/jme3/export/Savable;+631
j  com.jme3.export.binary.BinaryImporter.load(Ljava/io/InputStream;)Lcom/jme3/export/Savable;+4
j  com.jme3.export.binary.BinaryImporter.load(Lcom/jme3/asset/AssetInfo;)Ljava/lang/Object;+17
j  com.jme3.export.binary.BinaryLoader.load(Lcom/jme3/asset/AssetInfo;)Ljava/lang/Object;+27
j  com.jme3.asset.DesktopAssetManager.loadLocatedAsset(Lcom/jme3/asset/AssetKey;Lcom/jme3/asset/AssetInfo;Lcom/jme3/asset/AssetProcessor;Lcom/jme3/asset/cache/AssetCache;)Ljava/lang/Object;+21
j  com.jme3.asset.DesktopAssetManager.loadAsset(Lcom/jme3/asset/AssetKey;)Ljava/lang/Object;+190
j  com.jme3.asset.DesktopAssetManager.loadModel(Lcom/jme3/asset/ModelKey;)Lcom/jme3/scene/Spatial;+2
j  com.jme3.asset.DesktopAssetManager.loadModel(Ljava/lang/String;)Lcom/jme3/scene/Spatial;+9

Make the flags of the 5-parameter pSpace.update() method configurable when using BulletAppState

Hi Stephen,
I opened this Issue to track our conversation on the forum ;)
https://hub.jmonkeyengine.org/t/question-about-physicscollisionlistener/47248/11

eg:

        if (getThreadingType() == ThreadingType.SEQUENTIAL) {
            PhysicsSpace pSpace = getPhysicsSpace();
            float timeInterval = isEnabled() ? (tpf * getSpeed()) : 0f;

            if (stepSimulationConfig != null) {
                if (pSpace.maxSubSteps() == 0) {
                    timeInterval = Math.min(timeInterval, pSpace.maxTimeStep());
                }
                pSpace.update(timeInterval, pSpace.maxSubSteps(), 
                        stepSimulationConfig.isDoEnded(), 
                        stepSimulationConfig.isDoProcessed(), 
                        stepSimulationConfig.isDoStarted());
            } else {
                pSpace.update(timeInterval);
            }
        }

btVector3::normalize(): Assertion `!fuzzyZero()' failed

With a jumping character with non-default gravity and a static rigid body with a mesh shape, I get a btAssert() failure when the peak of the jump is inside the body's bounding box. (Only with a debug native library, of course.)

First seen in TestQ3 and HelloCollision, I've boiled it down to the following test case:

import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.collision.shapes.MeshCollisionShape;
import com.jme3.bullet.objects.PhysicsCharacter;
import com.jme3.bullet.objects.PhysicsRigidBody;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer;
import java.nio.FloatBuffer;
import jme3utilities.math.MyBuffer;
import jme3utilities.mesh.RectangleMesh;
import jme3utilities.minie.PhysicsDumper;

public class TestIssueXXX extends SimpleApplication implements ActionListener {

    private PhysicsCharacter character;

    public static void main(String[] args) {
        TestIssueXXX app = new TestIssueXXX();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        inputManager.addMapping("Jump", new KeyTrigger(KeyInput.KEY_SPACE));
        inputManager.addListener(this, "Jump");

        BulletAppState bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);
        bulletAppState.setDebugEnabled(true);

        Mesh mesh = new RectangleMesh(-999f, 999f, -999f, 999f, 1f);
        FloatBuffer buffer = mesh.getFloatBuffer(VertexBuffer.Type.Position);
        Quaternion rot = new Quaternion().fromAngles(1.5f, 0f, 0f);
        MyBuffer.rotate(buffer, 0, buffer.limit(), rot);
        CollisionShape meshShape = new MeshCollisionShape(mesh);
        PhysicsRigidBody staticBody = new PhysicsRigidBody(meshShape, 0f);
        bulletAppState.getPhysicsSpace().add(staticBody);

        CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1f, 3f);
        character = new PhysicsCharacter(capsuleShape, 0.05f);
        character.setGravity(30f);
        character.setPhysicsLocation(new Vector3f(0f, 10f, 0f));
        bulletAppState.getPhysicsSpace().add(character);

        new PhysicsDumper().dump(bulletAppState);
    }

    @Override
    public void onAction(String binding, boolean value, float tpf) {
        if (binding.equals("Jump")) {
            character.jump();
        }
    }
}

Be more expressive about a Version Matrix

When updating the dependencies for the SDK, I had troubles to find out which version of Minie is the last one targetting 3.4.0.
I've found the docs page and somewhere down it said "4.6.1 does not support 3.4.0 anymore", so I could deduct that I need 4.6.0.
From there, I've followed the POMs to add Heart 7.1.0 and Wes 0.6.7 (that needs Heart 7.0, but Wes 0.6.8 would need Heart 7.2).

Maybe you can add some easy to spot table or any other form of documentation, so one can easily see what versions they need when targetting a specific jme version (in case they can't bump their game's version)

soft-body simulation hangs with ConfigFlag.VF_SS

This issue was reported by Tharg, using the HelloSoftBody tutorial app with VF_SS set.

Here is a native stack (from GDB):

(gdb) bt
#0  0x00007f75f30c1d35 in buildTreeBottomUp (leafNodes=..., adj=...)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btSoftBody.cpp:85
#1  0x00007f75f30d206e in btSoftBody::rebuildNodeTree (this=0x7f75c0b680b0)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btSoftBody.cpp:2729
#2  0x00007f75f30d1b7a in btSoftBody::initializeFaceTree (this=0x7f75c0b680b0)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btSoftBody.cpp:2693
#3  0x00007f75f30ce6cb in btSoftBody::predictMotion (this=0x7f75c0b680b0, 
    dt=0.0166666675)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btSoftBody.cpp:2111
#4  0x00007f75f3336ee5 in btDefaultSoftBodySolver::predictMotion (
    this=0x7f75c0b51f60, timeStep=0.0166666675)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btDefaultSoftBodySolver.cpp:143
#5  0x00007f75f32e1e5f in btSoftRigidDynamicsWorld::predictUnconstraintMotion (
    this=0x7f75c0b10160, timeStep=0.0166666675)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btSoftRigidDynamicsWorld.cpp:74
#6  0x00007f75f32fe8f5 in btDiscreteDynamicsWorld::internalSingleStepSimulation
    (this=0x7f75c0b10160, timeStep=0.0166666675)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:463
#7  0x00007f75f32e1f2d in btSoftRigidDynamicsWorld::internalSingleStepSimulation (this=0x7f75c0b10160, timeStep=0.0166666675)
    at /home/travis/build/stephengold/Libbulletjme/src/main/native/bullet3/BulletSoftBody/btSoftRigidDynamicsWorld.cpp:88

some collision shapes fall through a flat terrain with contact filtering

As discussed at the JME forum: https://hub.jmonkeyengine.org/t/rounded-object-falls-through-terrain/47584

Changes to the test app that prevent fallthrough:

  1. disabling contact filtering on the terrain
  2. changing the ball's collision shape to a SphereCollisionShape or MultiSphere
  3. changing the ball's radius to 0.2 PSU or 10 PSU

Changes to the test app that don't prevent fallthrough:

  1. changing the ball's collision shape to a GImpactCollisionShape
  2. changing the ball's initial location to (0, 20, 0.001f) or (0.002f, 20, 0.001f) or (0.002f, 20.01f, 0.001f)

Must this be used with jMonkeyEngine?

Hello,

I am a developer that sometimes writes my own little projects using OpenGL. However, I do not use jMonkey. Is it possible to use this library for physics without using jMonkey?

incorrect contactStartedListeners in PhysicsSpace.onContactProcessed() method

Hi @stephengold ,
I think there is a typo in the newly added feature in the following method:

https://github.com/stephengold/Minie/blob/master/MinieLibrary/src/main/java/com/jme3/bullet/PhysicsSpace.java#L1273

    @Override
    public void onContactProcessed(PhysicsCollisionObject pcoA,
            PhysicsCollisionObject pcoB, long pointId) {
        assert NativeLibrary.jniEnvId() == jniEnvId() : "wrong thread";

        for (ContactListener listener : contactListeners) {
            listener.onContactProcessed(pcoA, pcoB, pointId);
        }

        if (!contactStartedListeners.isEmpty()) { // <- contactStartedListeners should be contactProcessedListeners
            PhysicsCollisionEvent event
                    = new PhysicsCollisionEvent(pcoA, pcoB, pointId);

            // Queue the event to be handled later by distributeEvents().
            contactProcessedEvents.add(event);
        }
    }

Thank you very much for accepting the requested change ;)

BetterCharacterControl hops across seams

When a BetterCharacterController moves back and forth across the seam between 2 triangles in a flat MeshCollisionShape, it sometimes makes an unexpected vertical hop.

This issue was reported (in JMonkeyEngine) as long ago as December 2013: https://hub.jmonkeyengine.org/t/bettercharactercontrol-acts-like-trampoline/28186 and also as recently as October 2021: https://hub.jmonkeyengine.org/t/bettercharactercontroller-bouncing-off-of-the-ground-while-moving/44991.

Thanks to @jcfandino, we now have a simple test that reproduces the issue. Note that the pauses (desiredVelocity.zero()) are necessary to reproduce the issue.

package jme3utilities.minie.test.issue;

import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.PhysicsSpace;
import com.jme3.bullet.PhysicsTickListener;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.BetterCharacterControl;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.bullet.objects.PhysicsRigidBody;
import com.jme3.bullet.util.CollisionShapeFactory;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Quad;

/**
 * Reproduce the hopping issue in BetterCharacterControl. If the issue is
 * present, numeric data will be printed to System.out .
 *
 * @author Stephen Gold [email protected]
 */
public class TestIssueXX
        extends SimpleApplication
        implements PhysicsTickListener {
    // *************************************************************************
    // fields

    /**
     * control under test
     */
    private BetterCharacterControl bcc;
    /**
     * true if character will move toward +X, false if it will move toward -X
     */
    private boolean increasingX;
    /**
     * largest Y value seen so far: anything larger than 0.05 is an issue
     */
    private float maxHeight = 0.05f;
    /**
     * count of physics timesteps simulated
     */
    private int tickCount = 0;
    // *************************************************************************
    // new methods exposed

    public static void main(String[] ignored) {
        TestIssueXX application = new TestIssueXX();
        application.start();
    }
    // *************************************************************************
    // SimpleApplication methods

    @Override
    public void simpleInitApp() {
        PhysicsSpace physicsSpace = configurePhysics();
        addGround(physicsSpace);

        Node controlledNode = new Node("controlled node");
        rootNode.attachChild(controlledNode);

        float characterRadius = 1f;
        float characterHeight = 4f;
        float characterMass = 1f;
        bcc = new BetterCharacterControl(characterRadius, characterHeight,
                characterMass);
        controlledNode.addControl(bcc);
        physicsSpace.add(bcc);
    }

    @Override
    public void simpleUpdate(float tpf) {
        /*
         * Terminate the test after 200 time steps.
         */
        if (tickCount > 200) {
            stop();
        }
    }
    // *************************************************************************
    // PhysicsTickListener methods

    @Override
    public void physicsTick(PhysicsSpace space, float timeStep) {
        /*
         * Determine the character's height and print it if it's a new high.
         */
        PhysicsRigidBody body = bcc.getRigidBody();
        Vector3f location = body.getPhysicsLocation();
        if (location.y > maxHeight) {
            maxHeight = location.y;
            System.out.println(tickCount + ": " + location);
        }
    }

    @Override
    public void prePhysicsTick(PhysicsSpace space, float timeStep) {
        ++tickCount;
        /*
         * Walk rapidly back and forth across the seam between the 2 triangles.
         */
        Vector3f desiredVelocity = new Vector3f();
        float walkSpeed = 99f;
        if (increasingX) {
            desiredVelocity.x = walkSpeed;
        } else {
            desiredVelocity.x = -walkSpeed;
        }

        Vector3f location = bcc.getRigidBody().getPhysicsLocation();
        if (increasingX && location.x > 7f) {
            // stop and reverse direction
            desiredVelocity.zero();
            increasingX = false;
        } else if (!increasingX && location.x < -7f) {
            // stop and reverse direction
            desiredVelocity.zero();
            increasingX = true;
        }

        bcc.setWalkDirection(desiredVelocity);
    }
    // *************************************************************************
    // private methods

    /**
     * Add a ground body to the specified PhysicsSpace.
     *
     * @param physicsSpace (not null)
     */
    private void addGround(PhysicsSpace physicsSpace) {
        Mesh quad = new Quad(1000f, 1000f);
        Spatial ground = new Geometry("ground", quad);
        ground.move(-500f, 0f, 500f);
        ground.rotate(-FastMath.HALF_PI, 0f, 0f);

        CollisionShape shape = CollisionShapeFactory.createMeshShape(ground);
        RigidBodyControl rbc = new RigidBodyControl(shape, 0f);
        rbc.setPhysicsSpace(physicsSpace);
        ground.addControl(rbc);
    }

    /**
     * Configure physics during startup.
     */
    private PhysicsSpace configurePhysics() {
        BulletAppState bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);

        PhysicsSpace result = bulletAppState.getPhysicsSpace();
        result.addTickListener(this);

        return result;
    }
}

Page not found for 'Collision Detection' link in README file

Hi Stephen,
the https://stephengold.github.io/Minie/minie/minie-library-tutorials/detect.html link (Collision Detection), in the tutorials section of the README file is broken.

Can you verify please?

The error message is as follows:

Page Not Found
The page youโ€™re looking for does not exist. It may have been moved.

If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken. 
If you typed the URL of this page manually, please double check that you entered the address correctly.

I hope I was helpful.

no bones for gltf model

I think there is problem with model - gltf exported model to j3o.

i always get shader error for even simple model, attach below

Uncaught exception thrown in Thread[jME3 Main,5,main]
RendererException: compile error in: ShaderSource[name=Common/MatDefs/Shadow/PreShadow.vert, defines, type=Vertex, language=GLSL150]
Vertex shader failed to compile with the following errors:
ERROR: 0:157: error(#102) #error: NUM_BONES must be between 1 and 255.
ERROR: 0:164: error(#186) Array size must be a positive integer
ERROR: error(#273) 2 compilation errors. No code generated

How much am i sure its Minie issue?
Because i just used Minie examples, replaced PuppetControl(removed interface) with one link "Armature_Arm", replaced Anim name in balanceTest to "cubeAnim" and model dir.

so i think its about model exported via gltf dont work.

this file was exported using https://github.com/KhronosGroup/glTF-Blender-Exporter/

(its older version of https://github.com/KhronosGroup/glTF-Blender-IO that correctly export animation to JME)

it have example static animation named "cubeAction"

test3.zip

Character fall through ground in HelloWalkOtoCc test

Hi @stephengold

When running HelloWalkOtoCc test the character fall through the terrain. I am using the master branch (cloned today).

Can you please confirm if it works fine for you?

OS: Linux Mint 20.1
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

Consider having pure getter/setter methods

Consider having pure getter/setter methods. For example in PhysicsCharacter.java, getUpDirection and setUp (I assume these are a pair despite the difference in naming), the getter actually takes in a parameter. With pure getter/setter I mean a getter is parameterless and returns the type whereas a setter takes one parameter of the type returning void. I also assume that in this example case getUpDirection takes a parameter as an optimization and it could be just omitted with a parameterless overload. Another example in this said class is get/setGravity.

This request comes from the jMonkeyEngine SDK, so it probably doesn't have any relation to actual usage in simulations/games. The SDK allows the user to modify object values in visual editors. These editors are based on basic Java Bean (?) properties.

PhysicsCharacter

vehicle acceleration depends on its location

In current More Advanced Vehicles (using Minie v3.0.0), vehicles occasionally accelerate much faster than they should. The issue is noticeable when accelerating from rest on a flat, horizontal surface.

I created a test app that reproduces the issue. Depending on the starting X and Z coordinates, the vehicle's Z velocity after a single simulation step can either be large (9.086558) or small (0.06497696). For starting coordinates uniformly distributed between 0 and 1, the outcome is approximately 18% large and 82% small. For fixed starting X and Z coordinates, however, the outcome seems to be highly repeatable.

public class TestIssue extends SimpleApplication {

    public static void main(String[] ignored) {
        TestIssue application = new TestIssue();
        application.start();
    }

    @Override
    public void simpleInitApp() {
        Random random = new Random();
        int largeVzCount = 0;
        int smallVzCount = 0;
        int otherCount = 0;

        for (int i = 0; i < 1000; ++i) {
            float x = random.nextFloat();
            float z = random.nextFloat();
            float vz = test(x, z);

            if (FastMath.approximateEquals(vz, 9.086558f)) {
                ++largeVzCount;
            } else if (FastMath.approximateEquals(vz, 0.06497696f)) {
                ++smallVzCount;
            } else {
                ++otherCount;
            }
        }

        System.out.println("largeVzCount = " + largeVzCount);
        System.out.println("smallVzCount = " + smallVzCount);
        System.out.println("otherCount = " + otherCount);

        stop();

    }

    private float test(float startX, float startZ) {
        PhysicsSpace physicsSpace
                = new PhysicsSpace(PhysicsSpace.BroadphaseType.DBVT);

        // Add a static plane to represent the ground.
        Plane plane = new Plane(Vector3f.UNIT_Y, 0f);
        PlaneCollisionShape shape = new PlaneCollisionShape(plane);
        PhysicsRigidBody body
                = new PhysicsRigidBody(shape, PhysicsBody.massForStatic);
        physicsSpace.addCollisionObject(body);

        // Create a wedge-shaped vehicle with a low center of gravity.
        // The local forward direction is +Z.
        float noseZ = 1.4f;
        float spoilerY = 0.5f;
        float tailZ = -0.7f;
        float undercarriageY = -0.1f;
        float halfWidth = 0.4f;
        Collection<Vector3f> cornerLocations = new ArrayList<>(6);
        cornerLocations.add(new Vector3f(+halfWidth, undercarriageY, noseZ));
        cornerLocations.add(new Vector3f(-halfWidth, undercarriageY, noseZ));
        cornerLocations.add(new Vector3f(+halfWidth, undercarriageY, tailZ));
        cornerLocations.add(new Vector3f(-halfWidth, undercarriageY, tailZ));
        cornerLocations.add(new Vector3f(+halfWidth, spoilerY, tailZ));
        cornerLocations.add(new Vector3f(-halfWidth, spoilerY, tailZ));
        HullCollisionShape wedgeShape
                = new HullCollisionShape(cornerLocations);

        float mass = 1525f;
        PhysicsVehicle vehicle = new PhysicsVehicle(wedgeShape, mass);
        vehicle.setDamping(0.086f, 0f);
        vehicle.setSuspensionCompression(6f);
        vehicle.setSuspensionDamping(7f);
        vehicle.setSuspensionStiffness(150f);

        // Add 4 wheels, 2 in the front (for steering) and 2 in the rear.
        boolean front = true;
        boolean rear = false;
        float frontAxisZ = 0.7f * noseZ;
        float rearAxisZ = 0.8f * tailZ;
        float radius = 0.425f; // of each tire
        float restLength = 0.2f; // of the suspension
        float xOffset = 0.9f * halfWidth;
        Vector3f axleDirection = new Vector3f(-1f, 0f, 0f);
        Vector3f suspensionDirection = new Vector3f(0f, -1f, 0f);
        vehicle.addWheel(new Vector3f(-xOffset, 0f, frontAxisZ),
                suspensionDirection, axleDirection, restLength, radius, front);
        vehicle.addWheel(new Vector3f(xOffset, 0f, frontAxisZ),
                suspensionDirection, axleDirection, restLength, radius, front);
        vehicle.addWheel(new Vector3f(-xOffset, 0f, rearAxisZ),
                suspensionDirection, axleDirection, restLength, radius, rear);
        vehicle.addWheel(new Vector3f(xOffset, 0f, rearAxisZ),
                suspensionDirection, axleDirection, restLength, radius, rear);

        for (int i = 0; i < 4; ++i) {
            VehicleWheel w = vehicle.getWheel(i);
            w.setFrictionSlip(0.32f);
            w.setMaxSuspensionForce(8000f);
            w.setRestLength(0.225f);
            w.setSuspensionStiffness(10f);
            w.setWheelsDampingCompression(2.087f);
            w.setWheelsDampingRelaxation(2.845f);
        }

        Vector3f startLocation = new Vector3f(startX, 0.382268f, startZ);
        vehicle.setPhysicsLocation(startLocation);
        physicsSpace.addCollisionObject(vehicle);

        // Simulate a single timestep.
        vehicle.accelerate(2, 415710f);
        vehicle.accelerate(3, 415710f);
        physicsSpace.update(1f / 60, 0);
        Vector3f velocity = vehicle.getLinearVelocity();

        physicsSpace.removeCollisionObject(vehicle);

        return velocity.z;
    }
}

JVM crash while serializing certain BoundingValueHierarchy objects on Windows

Prior discussion: https://hub.jmonkeyengine.org/t/jvm-crash-in-stranded/47354

Reduced test app:

    public void simpleInitApp() {
        assetManager.registerLocator(
                "C:\\Users\\sgold\\Downloads", FileLocator.class);
        Spatial geomPhy = assetManager.loadModel("pc-screen.gltf");

        CollisionShape meshShape
                = CollisionShapeFactory.createMeshShape(geomPhy);
        ChildCollisionShape[] children
                = ((CompoundCollisionShape) meshShape).listChildren();
        BoundingValueHierarchy bvh
                = ((MeshCollisionShape) (children[1].getShape())).getBvh();
        bvh.serialize();
        stop();
    }

Typical crash log (with an SpDebug native library):

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffb954ae231, pid=12036, tid=13220
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.3+7 (17.0.3+7) (build 17.0.3+7)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (17.0.3+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C  [bulletjme.dll+0x27e231]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -ea mygame.Main

Host: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, 12 cores, 31G,  Windows 11 , 64 bit Build 22621 (10.0.22621.3085)
Time: Thu Apr 18 12:42:45 2024 Pacific Daylight Time elapsed time: 2.874474 seconds (0d 0h 0m 2s)

---------------  T H R E A D  ---------------

Current thread (0x00000147381b2c70):  JavaThread "jME3 Main" [_thread_in_native, id=13220, stack(0x0000000377e00000,0x0000000377f00000)]

Stack: [0x0000000377e00000,0x0000000377f00000],  sp=0x0000000377eff0e0,  free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [bulletjme.dll+0x27e231]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.jme3.bullet.collision.shapes.infos.BoundingValueHierarchy.serialize(J)[B+0
j  com.jme3.bullet.collision.shapes.infos.BoundingValueHierarchy.serialize()[B+6
j  mygame.Main.simpleInitApp()V+54
j  com.jme3.app.SimpleApplication.initialize()V+282
j  com.jme3.system.lwjgl.LwjglWindow.initInThread()Z+112
j  com.jme3.system.lwjgl.LwjglWindow.run()V+34
j  java.lang.Thread.run()V+11 [email protected]
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0xffffffffffffffff


Register to memory mapping:

RIP=0x00007ffb954ae231 bulletjme.dll
RAX=0xdddddddddddddddd is an unknown value
RBX={method} {0x000001473fdc08c0} 'serialize' '(J)[B' in 'com/jme3/bullet/collision/shapes/infos/BoundingValueHierarchy'
RCX=0x0000014739403a10 points into unknown readable memory: 0xdddddddddddddddd | dd dd dd dd dd dd dd dd
RDX=0x0000014741c78080 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
RSP=0x0000000377eff0e0 is pointing into the stack for thread: 0x00000147381b2c70
RBP=0x0000000377eff1c0 is pointing into the stack for thread: 0x00000147381b2c70
RSI=0x0000000000000002 is an unknown value
RDI=0x0 is NULL
R8 =0x0000000099999a70 is an unknown value
R9 =0x0000014741c78001 points into unknown readable memory: 01 2b 08 47 01 00 00
R10=0x00007ffb95230000 bulletjme.dll
R11=0x0 is NULL
R12=0x0 is NULL
R13={method} {0x000001473fdc08c0} 'serialize' '(J)[B' in 'com/jme3/bullet/collision/shapes/infos/BoundingValueHierarchy'
R14=0x0000000377eff1e8 is pointing into the stack for thread: 0x00000147381b2c70
R15=0x00000147381b2c70 is a thread


Registers:
RAX=0xdddddddddddddddd, RBX=0x000001473fdc08b8, RCX=0x0000014739403a10, RDX=0x0000014741c78080
RSP=0x0000000377eff0e0, RBP=0x0000000377eff1c0, RSI=0x0000000000000002, RDI=0x0000000000000000
R8 =0x0000000099999a70, R9 =0x0000014741c78001, R10=0x00007ffb95230000, R11=0x0000000000000000
R12=0x0000000000000000, R13=0x000001473fdc08b8, R14=0x0000000377eff1e8, R15=0x00000147381b2c70
RIP=0x00007ffb954ae231, EFLAGS=0x0000000000010206

Top of Stack: (sp=0x0000000377eff0e0)
0x0000000377eff0e0:   0000000099999a70 0000000000000010
0x0000000377eff0f0:   000001473fdc08b8 00000147381b2c70
0x0000000377eff100:   0000000000000000 00000147120ed48e
0x0000000377eff110:   99999a703fdc08b8 0000014739403a10
0x0000000377eff120:   0000014741c78080 0000000000000000
0x0000000377eff130:   000001473fdc08b8 00000147120ed621
0x0000000377eff140:   00000147381b2f18 0000000377eff1d0
0x0000000377eff150:   0000014739403a10 0000000000000002
0x0000000377eff160:   000001473fd3a4d8 0000000000000000
0x0000000377eff170:   00000147120ed2f6 0000000377eff178
0x0000000377eff180:   000001473fdc08b8 0000000377eff1e8
0x0000000377eff190:   000001473fdc0aa8 0000000000000000
0x0000000377eff1a0:   00000006223f4158 000001473fdc08b8
0x0000000377eff1b0:   0000000000000000 0000000377eff1e0
0x0000000377eff1c0:   0000000377eff238 00000147120e9657
0x0000000377eff1d0:   00000006223f4158 00000147120eaf7b 

Instructions: (pc=0x00007ffb954ae231)
0x00007ffb954ae131:   ec 38 48 8b 44 24 50 48 89 44 24 20 48 83 7c 24
0x00007ffb954ae141:   20 00 75 1c 4c 8d 05 14 f6 35 00 48 8b 15 bd eb
0x00007ffb954ae151:   43 00 48 8b 4c 24 40 e8 e6 e5 d8 ff 33 c0 eb 3f
0x00007ffb954ae161:   48 8b 4c 24 20 e8 87 50 d8 ff 83 f8 15 74 1c 4c
0x00007ffb954ae171:   8d 05 19 f6 35 00 48 8b 15 7a ec 43 00 48 8b 4c
0x00007ffb954ae181:   24 40 e8 bb e5 d8 ff 33 c0 eb 14 48 8b 4c 24 20
0x00007ffb954ae191:   e8 38 ab d8 ff 48 89 44 24 28 48 8b 44 24 28 48
0x00007ffb954ae1a1:   83 c4 38 c3 cc cc cc cc cc cc cc cc cc cc cc 4c
0x00007ffb954ae1b1:   89 44 24 18 48 89 54 24 10 48 89 4c 24 08 48 83
0x00007ffb954ae1c1:   ec 58 48 8b 44 24 70 48 89 44 24 38 48 83 7c 24
0x00007ffb954ae1d1:   38 00 75 1f 4c 8d 05 fc f5 35 00 48 8b 15 2d eb
0x00007ffb954ae1e1:   43 00 48 8b 4c 24 60 e8 56 e5 d8 ff 33 c0 e9 d6
0x00007ffb954ae1f1:   00 00 00 48 8b 4c 24 38 e8 3b 62 d9 ff 89 44 24
0x00007ffb954ae201:   34 8b 44 24 34 ba 10 00 00 00 8b c8 e8 99 6d d9
0x00007ffb954ae211:   ff 48 89 44 24 40 48 8b 44 24 38 48 8b 00 41 b1
0x00007ffb954ae221:   01 44 8b 44 24 34 48 8b 54 24 40 48 8b 4c 24 38
0x00007ffb954ae231:   ff 50 10 88 44 24 30 0f b6 44 24 30 85 c0 75 1c
0x00007ffb954ae241:   4c 8d 05 b8 f5 35 00 48 8b 15 a9 eb 43 00 48 8b
0x00007ffb954ae251:   4c 24 60 e8 ea e4 d8 ff 33 c0 eb 6d 8b 54 24 34
0x00007ffb954ae261:   48 8b 4c 24 60 e8 8b 22 d9 ff 48 89 44 24 48 48
0x00007ffb954ae271:   8b 4c 24 60 e8 50 3b d8 ff 0f b6 c0 85 c0 74 04
0x00007ffb954ae281:   33 c0 eb 45 48 8b 44 24 40 48 89 44 24 20 44 8b
0x00007ffb954ae291:   4c 24 34 45 33 c0 48 8b 54 24 48 48 8b 4c 24 60
0x00007ffb954ae2a1:   e8 f9 a1 d8 ff 48 8b 4c 24 60 e8 1a 3b d8 ff 0f
0x00007ffb954ae2b1:   b6 c0 85 c0 74 04 33 c0 eb 0f 48 8b 4c 24 40 e8
0x00007ffb954ae2c1:   b5 4d d9 ff 48 8b 44 24 48 48 83 c4 58 c3 cc cc

BoundingValueHierarchy serialization data not portable

This issue dates back to Minie v0.7.2, when a workaround was implemented that discards serialized BVH data if the writer and reader were on different platforms.

The root cause is in Bullet's btQuantizedBvh.h, where the size of class btQuantizedBvh varies between platforms.
On Linux platforms (GCC compiler, both on x86_64 and arm64), the following assertions pass:

#ifdef BT_USE_DOUBLE_PRECISION
        btAssert(sizeof(btQuantizedBvh) == 296);
#else
        btAssert(sizeof(btQuantizedBvh) == 248);
#endif

On macOS (LLVM compiler) and Windows (Visual compiler) the same assertions often fail. Inferred from bvh.serialize() return values:

  • 64-bit Windows: 256 bytes in Sp, 304 bytes in Dp
  • MacOS with Arm CPU: 256 bytes in Sp, 296 bytes in Dp

Perhaps some padding is needed for data portability.

JRE crash with zero-thickness mesh shape in Minie v4.5

Reported by Koteinik at the JMonkeyEngine Forum/Hub: https://hub.jmonkeyengine.org/t/fatal-error-in-jre-when-using-minie/45129

This appears to be a regression in Minie v4.5 caused by the fix to issue #18.

Here's a test that triggers the crash with a debug native library:

    public void simpleInitApp() {
        BulletAppState bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);

        Node playerNode = new Node();
        rootNode.attachChild(playerNode);

        BetterCharacterControl player
                = new BetterCharacterControl(0.5f, 6f, 2f);
        playerNode.addControl(player);
        bulletAppState.getPhysicsSpace().add(player);

        Box b = new Box(0f, 1f, 16f);
        CollisionShape shape = new MeshCollisionShape(b);
        PhysicsRigidBody phys
                = new PhysicsRigidBody(shape, PhysicsBody.massForStatic);
        bulletAppState.getPhysicsSpace().addCollisionObject(phys);
    }

Maven dependency

Importing the project via:
<dependency> <groupId>com.github.stephengold</groupId> <artifactId>Minie</artifactId> <version>1.7.0</version> </dependency>
doesn't work (in Maven). It would be great if the tutorial could say how to import this project to maven.

pure virtual method called during TestCloneShapes on Linux

Continuous integration of Minie at GitHub Actions has been failing since I upgraded to Libbulletjme v11 on 8 August. More specifically, TestCloneShapes appears to fail, but only on Linux platforms. Java8, Java11, and Java16 are all impacted. More precisely, the failures started when Linux64 and Windows64 began actually using the Mt natives from LBJ.

The scope of the failure is narrow. GHA builds on macOS and Windows haven't failed. GHA builds of Libbulletjme haven't failed. And Linux builds at TravisCI and on my desktop haven't failed. Inability to replicate the issue on my desktop will make accurate diagnosis difficult.

Clues from the GHA logs:

jme3utilities.minie.test.TestCloneShapes > testCloneShapes STARTED
Debug_Mt_Libbulletjme version 11.0.0 initializing
pure virtual method called
terminate called without an active exception

After that, several other tests start, but then:

jme3utilities.minie.test.TestCloneShapes > testCloneShapes SKIPPED
FAILURE: Build failed with an exception.


> Task :MinieLibrary:test FAILED
* What went wrong:
52 actionable tasks: 51 executed, 1 up-to-date
Execution failed for task ':MinieLibrary:test'.

followed by a massive stack trace from Gradle, which reports the following cause:

Caused by: org.gradle.process.internal.ExecException: Process 'Gradle Test Executor 13' finished with non-zero exit value 134
This problem might be caused by incorrect test process configuration.
Please refer to the test execution section in the User Manual at https://docs.gradle.org/7.1.1/userguide/java_testing.html#sec:test_execution

btAssert from HingeJoint.setAngularOnly(true)

How to reproduce: add joint.setAngularOnly(true); to the HelloDoor app and run with a debug native library.
On Linux I get:

Feb 04, 2022 3:50:01 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 2
Debug_Libbulletjme version 12.7.1 initializing
warning btCollisionDispatcher::needsCollision: static-static collision!
java: /home/sgold/Git/Libbulletjme/src/main/native/bullet3/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp:1265: void btSequentialImpulseConstraintSolver::convertJoint(btSolverConstraint*, btTypedConstraint*, const btTypedConstraint::btConstraintInfo1&, int, int, const btContactSolverInfo&): Assertion `fsum > SIMD_EPSILON' failed.

The btAssert may be unnecessary, since there's code below it to handle the failure case...

TestCloneJoints crashes on MacOS X

https://travis-ci.org/github/stephengold/Minie/jobs/708212667 for SHA1 hash = 0a695c9

jme3utilities.minie.test.TestCloneJoints > testCloneJoints STARTED
Libbulletjme version 8.4.0 initializing
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/Users/travis/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.3.2-stable/9268edf0d6ff46f44d7ce8cb3653e20f89719832/jme3-core-3.3.2-stable.jar) to method sun.nio.ch.DirectBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java(2185,0x700003992000) malloc: *** error for object 0x7fe18bf57480: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Gradle: Problems with '+' sign in version number

I have tested the new Minie-4.9.0+bare and Minie-4.9.0+ano parts of Minie library on android, and i found out that the bare part always replaces the ano part if both are added as dependencies, i suspect the problem comes from using '+' sign in declaring minie parts, in which gradle consumes it as a different version of minie, so a suggestion for the next release and for an eventual fix is to omit the '+' sign from minie parts and replace it by library-module:version classical way of defining library parts.

So, this is better :

implementation "com.github.stephengold:Minie-bare:5.x.x"
implementation "com.github.stephengold:Minie-ano:5.x.x"

instead of this :

implementation "com.github.stephengold:Minie:5.x.x+bare"
implementation "com.github.stephengold:Minie:5.x.x+bare"

By doing this, you are actually creating different artificatId names under the hood under the same library.

TestCloneBody crashes Java 14 JVM on Windows

So far, seen only at GitHub actions:

  1. https://github.com/stephengold/Minie/runs/861771383 for commit hash a10d577:
jme3utilities.minie.test.TestCloneBody > testCloneBody STARTED
Debug_Libbulletjme version 8.4.0 initializing
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffdfcfac458, pid=5012, tid=6656
#
WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
# JRE version: OpenJDK Runtime Environment Zulu14.28+21-CA (14.0.1+8) (build 14.0.1+8)
# Java VM: OpenJDK 64-Bit Server VM Zulu14.28+21-CA (14.0.1+8, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [bulletjme.dll+0x13c458]
#
# Core dump will be written. Default location: D:\a\Minie\Minie\MinieLibrary\hs_err_pid5012.mdmp
#
# An error report file with more information is saved as:
# D:\a\Minie\Minie\MinieLibrary\hs_err_pid5012.log
#
# If you would like to submit a bug report, please visit:
#   http://www.azulsystems.com/support/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Terminate batch job (Y/N)? 
##[error]The operation was canceled.

The job was cancelled after 6 hours of runtime(!) No artifacts were generated.

  1. https://github.com/stephengold/Minie/runs/848041937 for commit hash 57bc126:
jme3utilities.minie.test.TestCloneBody > testCloneBody STARTED
Debug_Libbulletjme version 8.3.0 initializing
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Users/runneradmin/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.3.2-stable/9268edf0d6ff46f44d7ce8cb3653e20f89719832/jme3-core-3.3.2-stable.jar) to method sun.nio.ch.DirectBuffer.cleaner()
#
# A fatal error has been detected by the Java Runtime Environment:
WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
#
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffa596cc238, pid=3436, tid=6324
WARNING: All illegal access operations will be denied in a future release
#
# JRE version: OpenJDK Runtime Environment Zulu14.28+21-CA (14.0.1+8) (build 14.0.1+8)
# Java VM: OpenJDK 64-Bit Server VM Zulu14.28+21-CA (14.0.1+8, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [bulletjme.dll+0x13c238]
#
# Core dump will be written. Default location: D:\a\Minie\Minie\MinieLibrary\hs_err_pid3436.mdmp
#
# An error report file with more information is saved as:
# D:\a\Minie\Minie\MinieLibrary\hs_err_pid3436.log
#
# If you would like to submit a bug report, please visit:
#   http://www.azulsystems.com/support/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Unexpected exception thrown.

org.gradle.internal.remote.internal.MessageIOException: Could not write '/127.0.0.1:50233'.

The crash log was recovered. Here is the stack:

Current thread (0x000001ac1e8b8800):  JavaThread "Physics Cleaner" daemon [_thread_in_native, id=6324, stack(0x000000a22c900000,0x000000a22ca00000)]

Stack: [0x000000a22c900000,0x000000a22ca00000],  sp=0x000000a22c9fe920,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [bulletjme.dll+0x13c238]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.jme3.bullet.collision.PhysicsCollisionObject.finalizeNative(J)V+0
j  com.jme3.bullet.collision.PhysicsCollisionObject.freeNativeObject(J)V+21
v  ~StubRoutines::call_stub
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 [email protected]
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 [email protected]
j  jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 [email protected]
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 [email protected]
j  com.jme3.bullet.NpoTracker.freeTrackedObject()V+71
j  com.jme3.bullet.NativePhysicsObject.freeUnusedObjects()V+11
j  com.jme3.bullet.util.NativeLibrary$1.run()V+0
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0xffffffffffffffff
  1. https://github.com/stephengold/Minie/runs/814307022 for commit hash 9aa2249
jme3utilities.minie.test.TestCloneBody > testCloneBody STARTED
WARNING: All illegal access operations will be denied in a future release
Debug_Libbulletjme version 8.2.0 initializing
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd41b9bde8, pid=1260, tid=356
#
# JRE version: OpenJDK Runtime Environment Zulu14.28+21-CA (14.0.1+8) (build 14.0.1+8)
# Java VM: OpenJDK 64-Bit Server VM Zulu14.28+21-CA (14.0.1+8, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [bulletjme.dll+0x13bde8]
#
# Core dump will be written. Default location: D:\a\Minie\Minie\MinieLibrary\hs_err_pid1260.mdmp
#
# An error report file with more information is saved as:
# D:\a\Minie\Minie\MinieLibrary\hs_err_pid1260.log
#
# If you would like to submit a bug report, please visit:
#   http://www.azulsystems.com/support/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

No artifacts were generated.

Bug of PreComposer

Hi, I found that there may be bugs in the version 5.1.0

"armature.getJointCount();" causes NPE in PreComposer when I remove DynamicAnimControl . (the "removeSpatialData" method in DacLinks will set the armature to null)

Another, PreComposer is created in "createSpatialData" but seems never removed in "removeSpatialData".
So when I add and remove DynamicAnimControl multiple times, there may be more than one PreComposer in the spatial.

Hope this helps.
20220824191130

Minie iOS support.

Now that Minie has support for Android, I thought that maybe jME could take some steps towards making Minie the official physics engine. My first step as you know was to remove Bullet, but it sounds like we can't do that until Minie supports iOS, so I was wondering if you have made any progress or if you plan on working iOS support into the project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.