[Fixed]assert fail? ”Attempted to aquire TempVars lock owned by” jme3 r7296

http://i.imgur.com/MfWyH.jpg

INFO: Loaded material definition: Phong Lighting
Apr 24, 2011 12:52:41 AM com.jme3.scene.Node attachChild
INFO: Child (Oto-geom-1) attached to this node (Oto-ogremesh)
Apr 24, 2011 12:52:41 AM com.jme3.scene.Node attachChild
INFO: Child (Oto-ogremesh) attached to this node (Shootables)
origin: (0.8537352, 3.9594455, 72.088524) / dir: (0.5776163, 3.7627294, 71.694176)
Apr 24, 2011 12:52:41 AM com.jme3.scene.Node attachChild
INFO: Child (BOOM!) attached to this node (Root Node)
INTERNAL ERROR
Offending trace:
at com.jme3.animation.Bone.getOffsetTransform(Bone.java:341)
at com.jme3.animation.Skeleton.computeSkinningMatrices(Skeleton.java:216)
at com.jme3.animation.SkeletonControl.controlRender(SkeletonControl.java:64)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:90)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:515)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:509)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:515)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:515)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:705)
at com.jme3.renderer.RenderManager.render(RenderManager.java:737)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:257)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:137)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:161)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:206)
at java.lang.Thread.run(Thread.java:722)
Attempted to aquire TempVars lock owned by
at com.jme3.animation.Skeleton.computeSkinningMatrices(Skeleton.java:214)
at com.jme3.animation.SkeletonControl.controlRender(SkeletonControl.java:64)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:90)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:515)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:509)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:515)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:515)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:705)
at com.jme3.renderer.RenderManager.render(RenderManager.java:737)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:257)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:137)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:161)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:206)
at java.lang.Thread.run(Thread.java:722)

In this code (with assert enabled ie. JVM arg "-ea":
[java]package org.jme3.forum;
/*
* Copyright (c) 2009-2010 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.prefs.BackingStoreException;
import com.jme3.app.SimpleApplication;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Ray;
import com.jme3.math.Transform;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.debug.Arrow;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Line;
import com.jme3.system.AppSettings;
public class TestMousePickAgain extends SimpleApplication {
public static void main(String[] args) throws BackingStoreException {
TestMousePickAgain app = new TestMousePickAgain();
AppSettings aps = new AppSettings(true);
aps.load(aps.getTitle());
aps.setVSync(true);
app.setShowSettings(false);
app.setSettings(aps);
app.start();
}
Node shootables;
Geometry mark;
@Override
public void simpleInitApp() {
// flyCam.setEnabled(false);
flyCam.setDragToRotate(true);
flyCam.setMoveSpeed(20f);
initMark(); // a red sphere to mark the hit
/** create four colored boxes and a floor to shoot at: */
shootables = new Node("Shootables");
rootNode.attachChild(shootables);
shootables.attachChild(makeCube("a Dragon", -2f, 0f, 1f));
shootables.attachChild(makeCube("a tin can", 1f, -2f, 0f));
shootables.attachChild(makeCube("the Sheriff", 0f, 1f, -2f));
shootables.attachChild(makeCube("the Deputy", 1f, 0f, -4f));
shootables.attachChild(makeFloor());
shootables.attachChild(makeCharacter());
rootNode.scale(3.5f, 4.2f, 4.7f);
rootNode.rotate(FastMath.DEG_TO_RAD * 65f, FastMath.DEG_TO_RAD * 65f,
FastMath.DEG_TO_RAD * 65f);
rootNode.setLocalTranslation(0, 0, 0 // - 29//
);// XXX:
cam.setLocation(new Vector3f(1.4989337f, 4.4191055f, 73.00994f));
cam.setRotation(new Quaternion(-0.0011200219f, 0.9985451f,
-0.022919897f, -0.048795838f));
cam.setDirection(new Vector3f(-0.09739835f, -0.045882408f, -0.99418724f));
}
@Override
public void simpleUpdate(float tpf) {
Vector3f origin = cam.getWorldCoordinates(
inputManager.getCursorPosition(), 0.0f);
Vector3f direction = cam.getWorldCoordinates(
inputManager.getCursorPosition(), 0.3f);
System.out.println("origin: " + origin + " / dir: " + direction);
direction.subtractLocal(origin).normalizeLocal();
// direction = origin.subtract(direction).normalize();
// Transform tr =
// rootNode.getWorldTransform();
// origin =
// tr.transformVector(
// origin,
// null );
// direction =
// tr.transformVector(
// direction,
// null );
// System.out.println( "origin : "
// + origin );
// System.out.println( "direction: "
// + direction );
Ray ray = new Ray(origin, direction);
CollisionResults results = new CollisionResults();
shootables.collideWith(ray, results);
if (results.size() > 0) {
CollisionResult closest = results.getClosestCollision();
Vector3f contact = closest.getContactPoint();
Vector3f normal = closest.getContactNormal();
// System.out.println(normal.normalize().angleBetween(
// contact.normalize())
// * FastMath.RAD_TO_DEG);
// Vector3f upVec = contact.cross(normal);
// Vector3f normalVec = normal.subtract(contact).normalizeLocal();
// // System.out.println(upVec.normalize().angleBetween(
// // contact.normalize())
// // * FastMath.RAD_TO_DEG);
// // System.out.println(upVec.normalize().angleBetween(
// // normal.normalize())
// // * FastMath.RAD_TO_DEG);
//
contact = rootNode.worldToLocal(contact, null);
normal = rootNode.worldToLocal(normal, null);
// // Transform tr = rootNode.getWorldTransform();
// // // Vector3f upVec =
// // // contact.cross(normal)
// // // rootNode.worldToLocal(Vector3f.UNIT_Y, null);
// normalVec = rootNode.worldToLocal(normalVec, null);
// normalVec.normalizeLocal();
// // // upVec = tr.transformInverseVector(upVec, null);
// // contact = tr.transformInverseVector(contact, null);
// // normal = tr.transformInverseVector(normal, null);
rootNode.attachChild(mark);
mark.setLocalTranslation(contact);
Vector3f upVec = rootNode.worldToLocal(Vector3f.UNIT_Y, null);
Quaternion q =
// // rootNode.getLocalRotation();
// // // tr.getRotation().clone().opposite();
new Quaternion();
//
// // Vector3f.UNIT_Y;
// // tr.transformInverseVector(
// // Vector3f.UNIT_Y,
// // null );
// makes Z axis be in the same direction as `normal`
// (our `mark` arrow is on the Z axis)
q.lookAt(normal, upVec.normalize());
// q.multLocal(rootNode.getLocalRotation().opposite());
mark.setLocalRotation(q);
// mark.lookAt(normalVec, upVec);
// mark.lookAt(
// normal,
// upVec );
// q.subtractLocal( tr.getRotation().clone() );
// q.multLocal( tr.getRotation().inverse() );
// System.out.println( tr.getRotation(). );
// Line line = new Line(contact, normalVec);
// Geometry geoLine = new Geometry("line1", line);
// // mark = new Geometry("BOOM!", sphere);
// Material mark_mat = new Material(assetManager,
// "Common/MatDefs/Misc/SolidColor.j3md");
// mark_mat.setColor("Color", ColorRGBA.Red);
// geoLine.setMaterial(mark_mat);
// geoLine.setLocalTranslation(contact);
// // geoLine.setLocalTransform(tr);
// // geoLine.worldToLocal(in, store)
// rootNode.attachChild(geoLine);
} else {
rootNode.detachChild(mark);
}
}
/** A cube object for target practice */
protected Geometry makeCube(String name, float x, float y, float z) {
Box box = new Box(new Vector3f(x, y, z), 1, 1, 1);
Geometry cube = new Geometry(name, box);
Material mat1 = new Material(assetManager,
"Common/MatDefs/Misc/SolidColor.j3md");
mat1.setColor("Color", ColorRGBA.randomColor());
cube.setMaterial(mat1);
return cube;
}
/** A floor to show that the "shot" can go through several objects. */
protected Geometry makeFloor() {
Box box = new Box(new Vector3f(0, -4, -5), 15, .2f, 15);
Geometry floor = new Geometry("the Floor", box);
Material mat1 = new Material(assetManager,
"Common/MatDefs/Misc/SolidColor.j3md");
mat1.setColor("Color", ColorRGBA.Gray);
floor.setMaterial(mat1);
return floor;
}
/** A red ball that marks the last spot that was "hit" by the "shot". */
protected void initMark() {
Arrow arrow = new Arrow(Vector3f.UNIT_Z.mult(2f));
arrow.setLineWidth(3);
// Sphere sphere = new Sphere(30, 30, 0.2f);
mark = new Geometry("BOOM!", arrow);
// mark = new Geometry("BOOM!", sphere);
Material mark_mat = new Material(assetManager,
"Common/MatDefs/Misc/SolidColor.j3md");
mark_mat.setColor("Color", ColorRGBA.Red);
mark.setMaterial(mark_mat);
}
protected Spatial makeCharacter() {
// load a character from jme3test-test-data
Spatial golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
golem.scale(0.5f);
golem.setLocalTranslation(-1.0f, -1.5f, -0.6f);
// We must add a light to make the model visible
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
golem.addLight(sun);
return golem;
}
}[/java]
1 Like

Thank you, it’s fixed in last SVN.

1 Like