TestPhysicsHingeJoint.java is not working in eclipse

I was testing the Sample Code (TestPhysicsHingeJoint.java) in Eclipse. what is the problem with the error?
JME3

Code

package jme3test.bullet;

import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.PhysicsSpace;
import com.jme3.bullet.collision.shapes.BoxCollisionShape;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.bullet.joints.HingeJoint;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.AnalogListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;

public class TestPhysicsHingeJoint extends SimpleApplication implements AnalogListener{
	private BulletAppState bulletAppState;
	private HingeJoint joint;
	
	public static void main(String [] args) {
		TestPhysicsHingeJoint app = new TestPhysicsHingeJoint();
		app.start();
	}
	
	private void setupKeys() {
		inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_H));
		inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_K));
		inputManager.addMapping("Swing", new KeyTrigger(KeyInput.KEY_SPACE));
		inputManager.addListener(this, "Left", "Right", "Swing");
	}
	
	@Override
	public void onAnalog(String binding, float value, float tpf) {
		if(binding.equals("Left")) {
			joint.enableMotor(true, 1, .1f);
		}
		else if(binding.equals("Right")) {
			joint.enableMotor(true, -1, .1f);
		}
		else if(binding.equals("Swing")) {
			joint.enableMotor(false, 0, 0);
		}
	}
	
	@Override
	public void simpleInitApp() {
		bulletAppState = new BulletAppState();
		stateManager.attach(bulletAppState);
		bulletAppState.setDebugEnabled(true);
		setupKeys();
		setupJoint();
	}
	
	private PhysicsSpace getPhysicsSpace() {
		return bulletAppState.getPhysicsSpace();
	}
	
	public void setupJoint() {
		Node holderNode=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f( .1f, .1f, .1f)),0);
		holderNode.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f,0,0f));
		rootNode.attachChild(holderNode);
		getPhysicsSpace().add(holderNode);
		
		Node hammerNode=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f( .3f, .3f, .3f)),1);
		hammerNode.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f,-1,0f));
		rootNode.attachChild(hammerNode);
		getPhysicsSpace().add(hammerNode);
		
		joint=new HingeJoint(holderNode.getControl(RigidBodyControl.class), hammerNode.getControl(RigidBodyControl.class), Vector3f.ZERO, new Vector3f(0f,-1,0f), Vector3f.UNIT_Z, Vector3f.UNIT_Z);
		getPhysicsSpace().add(joint);
	}
	
	@Override
	public void simpleUpdate(float tpf) {
		
	}
}

Error

Uncaught exception thrown in Thread[jME3 Main,5,main]
VerifyError: Stack map does not match the one at exception handler 265
Exception Details:
  Location:
    com/bulletphysics/dynamics/constraintsolver/HingeConstraint.<init>(Lcom/bulletphysics/dynamics/RigidBody;Lcom/bulletphysics/linearmath/Transform;)V @265: aload_3
  Reason:
    Current frame's flags are not assignable to stack map frame's.
  Current Frame:
    bci: @4
    flags: { flagThisUninit }
    locals: { uninitializedThis, 'com/bulletphysics/dynamics/RigidBody', 'com/bulletphysics/linearmath/Transform', 'com/bulletphysics/$Stack' }
    stack: { 'java/lang/Throwable' }
  Stackmap Frame:
    bci: @265
    flags: { }
    locals: { top, 'com/bulletphysics/dynamics/RigidBody', 'com/bulletphysics/linearmath/Transform', 'com/bulletphysics/$Stack' }
    stack: { 'java/lang/Throwable' }
  Bytecode:
    0000000: b800 404e 2db6 0049 2ab2 0023 2bb7 00c6
    0000010: 2a06 bd00 2859 03bb 0028 59b7 002a 5359
    0000020: 04bb 0028 59b7 002a 5359 05bb 0028 59b7
    0000030: 002a 53b5 002c 2a06 bd00 2859 03bb 0028
    0000040: 59b7 002a 5359 04bb 0028 59b7 002a 5359
    0000050: 05bb 0028 59b7 002a 53b5 002e 2abb 0030
    0000060: 59b7 0031 b500 332a bb00 3059 b700 31b5
    0000070: 0035 2ab4 0033 2cb6 00da 2ab4 0035 2cb6
    0000080: 00da 2a03 b500 4e2a 03b5 0037 2ab4 0035
    0000090: b400 6a59 b400 dd12 de6a b500 dd2a b400
    00000a0: 35b4 006a 59b4 00e1 12de 6ab5 00e1 2ab4
    00000b0: 0035 b400 6a59 b400 e412 de6a b500 e42a
    00000c0: b400 35b4 0052 2ab4 0033 b400 52b6 0058
    00000d0: 2b2d b600 60b6 0066 2ab4 0035 b400 52b6
    00000e0: 00d6 2a12 99b5 009b 2a12 9cb5 009e 2a12
    00000f0: 9fb5 00a1 2a0c b500 a32a 12a4 b500 a62a
    0000100: 03b5 00a8 2db6 00b1 b12d b600 b1bf     
  Exception Handler Table:
    bci [4, 265] => handler: 265
  Stackmap Table:
    full_frame(@265,{Top,Object[#98],Object[#48],Object[#60]},{Object[#194]})

its only in Eclipse?

Anyway i would suggest try:

  • use LWJGL3 / try disable/enable hardware skinning
  • Use Minie library(its same bullet lib, but better maintained)

hope others will know more, but myself i see this error first time.

So I ran that code in the jMonkey SKD, not eclipse. I had errors in the setupJoint() method because PhysicsTestHelper is it’s own file.

PhysicsTestHelper

Make sure you have that in your project–

1 Like