What jars are you adding exactly? The standard jbullet-jme install should not interfere with jme2 at all when it is not used.
Cheers,
Normen
Hey normen,
Thanks for replying.
Default jars i have are
gluegen-rt.jar
jogl.jar
jorbis
jinput
lwjgl.jar
lwjgl_util.jar
lwjgl_util_applet
swt.jar
jme-collara-bidning-src.jar
jme-colladabinding.jar
and jBullet jars i add are
asm-all-3.1.jar
jbullet-jme.jar
jbullet.jar
stack-alloc.jar
vecmath.jar
Then init method in debug is no longer called. Didn't think adding jars would affect this at all. soooooo strange.
console output
without jbullet in the library
Apr 11, 2010 2:42:54 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Apr 11, 2010 2:42:54 AM com.jmex.awt.jogl.JOGLAWTCanvas getBackground
INFO: getBackground
Apr 11, 2010 2:42:54 AM com.jme.renderer.jogl.JOGLRenderer <init>
INFO: JOGLRenderer created. W: 800H: 600 Version: 1.1.1
Apr 11, 2010 2:42:55 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Apr 11, 2010 2:42:55 AM com.jmex.audio.openal.OpenALSystem setupSourcePool
INFO: max source channels: 32
Apr 11, 2010 2:42:55 AM com.jmex.game.state.GameStateManager create
INFO: Created GameStateManager
Apr 11, 2010 2:42:55 AM com.jme.scene.Node <init>
INFO: Node created.
Apr 11, 2010 2:42:55 AM com.jme.scene.Node <init>
INFO: Node created.
Apr 11, 2010 2:42:55 AM com.jme.scene.Node attachChild
INFO: Child "Text" attached to this node "TextNode"
Apr 11, 2010 2:42:55 AM com.jme.scene.Node <init>
INFO: Node created.
init called successfully
Apr 11, 2010 2:42:55 AM com.jme.scene.Node attachChild
INFO: Child "my box" attached to this node "RootNode"
with jbullet jars in library
Apr 11, 2010 2:38:28 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Apr 11, 2010 2:38:28 AM com.jmex.awt.jogl.JOGLAWTCanvas getBackground
INFO: getBackground
Apr 11, 2010 2:38:28 AM com.jme.renderer.jogl.JOGLRenderer <init>
INFO: JOGLRenderer created. W: 800H: 600 Version: 1.1.1
Apr 11, 2010 2:38:28 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Apr 11, 2010 2:38:28 AM com.jmex.audio.openal.OpenALSystem setupSourcePool
INFO: max source channels: 32
Apr 11, 2010 2:38:28 AM com.jmex.game.state.GameStateManager create
INFO: Created GameStateManager
Apr 11, 2010 2:38:29 AM com.jme.scene.Node <init>
INFO: Node created.
Apr 11, 2010 2:38:29 AM com.jme.scene.Node <init>
INFO: Node created.
Apr 11, 2010 2:38:29 AM com.jme.scene.Node attachChild
INFO: Child "Text" attached to this node "TextNode"
Apr 11, 2010 2:38:29 AM com.jme.scene.Node <init>
INFO: Node created.
oO can you show me the whole source of your app?
going to restart, wipe it all and reinstall/reconfigure everything from the rar files i downloaded.
Only 2 classes i have changed are
TestStandardGame.java
/*
* Copyright (c) 2003-2009 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.
*/
package jmetest.game;
import java.util.concurrent.Callable;
import com.jme.util.GameTaskQueueManager;
import com.jmex.editors.swing.settings.GameSettingsPanel;
import com.jmex.game.StandardGame;
import com.jmex.game.state.DebugGameState;
import com.jmex.game.state.GameStateManager;
/**
* <code>TestStandardGame</code> is meant to be an example replacement of
* <code>jmetest.base.TestSimpleGame</code> using the StandardGame implementation
* instead of SimpleGame.
*
* @author Matthew D. Hicks
*/
public class TestStandardGame {
public static void main(String[] args) throws Exception {
// Enable statistics gathering
System.setProperty("jme.stats", "set");
// Instantiate StandardGame
StandardGame game = new StandardGame("A Simple Test");
// Show settings screen
if (GameSettingsPanel.prompt(game.getSettings())) {
// Start StandardGame, it will block until it has initialized successfully, then return
game.start();
GameTaskQueueManager.getManager().update(new Callable<Void>() {
public Void call() throws Exception {
// Create a DebugGameState - has all the built-in features that SimpleGame provides
// NOTE: for a distributable game implementation you'll want to use something like
// BasicGameState instead and provide control features yourself.
DebugGameState state = new DebugGameState();
// Put our box in it
// Add it to the manager
GameStateManager.getInstance().attachChild(state);
// Activate the game state
state.setActive(true);
return null;
}
});
}
}
}
and
the init method inside DebugGameState.java
private void init(boolean handleInput) {
rootNode = new Node("RootNode");
System.out.println("init called successfully");
// Create a wirestate to toggle on and off. Starts disabled with default
// width of 1 pixel.
wireState = DisplaySystem.getDisplaySystem().getRenderer()
.createWireframeState();
wireState.setEnabled(false);
rootNode.setRenderState(wireState);
Box box = new Box("my box", new Vector3f(0, 0, 0), 2, 2, 2);
// We had to add the following line because the render thread is already running
// Anytime we add content we need to updateRenderState or we get funky effects
getRootNode().attachChild(box);
box.updateRenderState();
// Create ZBuffer for depth
ZBufferState zbs = DisplaySystem.getDisplaySystem().getRenderer()
.createZBufferState();
zbs.setEnabled(true);
zbs.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
rootNode.setRenderState(zbs);
// Lighting
/** Set up a basic, default light. */
PointLight light = new PointLight();
light.setDiffuse( new ColorRGBA( 0.75f, 0.75f, 0.75f, 0.75f ) );
light.setAmbient( new ColorRGBA( 0.5f, 0.5f, 0.5f, 1.0f ) );
light.setLocation( new Vector3f( 100, 100, 100 ) );
light.setEnabled( true );
/** Attach the light to a lightState and the lightState to rootNode. */
lightState = DisplaySystem.getDisplaySystem().getRenderer().createLightState();
lightState.setEnabled( true );
lightState.attach( light );
rootNode.setRenderState( lightState );
// Initial InputHandler
if (handleInput) {
input = new FirstPersonHandler(DisplaySystem.getDisplaySystem().getRenderer().getCamera(), 15.0f, 0.5f);
initKeyBindings();
}
// Finish up
rootNode.updateRenderState();
rootNode.updateWorldBound();
rootNode.updateGeometricState(0.0f, true);
}
Probably you added your complete desktop to the classpath and had some other stuff lying there? Anyway, glad it works.
This is a newbie question.
I'm unable to add a terrain to my code. I'm using compiled version of jme-jbullet, because of the firewall I can't use CVS, SVN.
Here is my code.
2
3 try {
4 grassURL = new File("data/texture/grassb.png").toURI().toURL();
5 pyramidURL = new File("data/texture/pyramid").toURI().toURL();
6
7 } catch (MalformedURLException e) {
8 e.printStackTrace();
9 }
10
11 MidPointHeightMap mph = new MidPointHeightMap(1024, 1.5f);
12 TerrainBlock terrainBlock = new TerrainBlock("midpoint block", mph.getSize(), new Vector3f(10, 1, 10), mph.getHeightMap(),
13 new Vector3f(100f, -50f, -100f));
14
15 terrainBlock.setDetailTexture(1, 16);
16
17
18 TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
19 ts.setTexture(TextureManager.loadTexture(grassURL,
20 Texture.MinificationFilter.BilinearNearestMipMap,
21 Texture.MagnificationFilter.Bilinear));
22 terrainBlock.setRenderState(ts);
23
24
25 terrainBlock.setModelBound(new BoundingBox());
26 terrainBlock.updateModelBound();
27
28
29 state.getRootNode().attachChild(terrainBlock);
30
31 MeshCollisionShape collisionShape = new MeshCollisionShape(terrainBlock);
32
33
34 PhysicsNode terrainPhysicsNode = new PhysicsNode(terrainBlock,
35 collisionShape, 0);
36 terrainPhysicsNode.setLocalTranslation(new Vector3f(0, -6, 0));
37
38 terrainPhysicsNode.rotateUpTo(new Vector3f(0, 1, 0));
I also wonder how add textures and colours to my physical cube. I tried to set colour like below but it didn't work, I see just a gray box.
Box box = new Box("test box", Vector3f.ZERO, 1f, 1f, 1f);
box.setSolidColor(ColorRGBA.blue);
PhysicsNode boxPhysics = new PhysicsNode(box,
CollisionShape.ShapeTypes.MESH);
boxPhysics.setLocalTranslation(new Vector3f(3f, 0f, 0f));
state.getRootNode().attachChild(boxPhysics);
boxPhysics.updateRenderState();
PhysicsSpace.getPhysicsSpace().add(boxPhysics);
Got the problem it's becoz I missed following 2 methods.
gameState.getRootNode().attachChild(terrainPhysics) and terrainPhysics.updateRenderState().
JBullet-Jme wiki is missing these methods. What wiki says is
RawHeightMap heightMap = new RawHeightMap(ActionGame.class
.getClassLoader().getResource("heights.raw"),
129, RawHeightMap.FORMAT_16BITLE, false);
TerrainBlock terrainBlock = new TerrainBlock("Terrain", heightMap.getSize(), terrainScale,
heightMap.getHeightMap(),
new Vector3f(0, 0, 0));
MeshCollisionShape collisionShape=new MeshCollisionShape(terrainBlock);
PhysicsNode terrainPhysicsNode=new PhysicsNode(terrainBlock, collisionShape,0);
terrainPhysicsNode.setLocalTranslation(new Vector3f(-300,-10,-300));
terrainPhysicsNode.rotateUpTo(new Vector3f(0,1,0));
PhysicsSpace.getPhysicsSpace().add(terrainPhysicsNode);
I would recommend it to change
RawHeightMap heightMap = new RawHeightMap(ActionGame.class
.getClassLoader().getResource("heights.raw"),
129, RawHeightMap.FORMAT_16BITLE, false);
TerrainBlock terrainBlock = new TerrainBlock("Terrain", heightMap.getSize(), terrainScale,
heightMap.getHeightMap(),
new Vector3f(0, 0, 0));
MeshCollisionShape collisionShape=new MeshCollisionShape(terrainBlock);
PhysicsNode terrainPhysicsNode=new PhysicsNode(terrainBlock, collisionShape,0);
terrainPhysicsNode.setLocalTranslation(new Vector3f(-300,-10,-300));
terrainPhysicsNode.rotateUpTo(new Vector3f(0,1,0));
gameState.getRootNode().attachChild(terrainPhysicsNode); // Missing in the wiki
terrainPhysicsNode.updateRenderState(); // Missing in the wiki
PhysicsSpace.getPhysicsSpace().add(terrainPhysicsNode);
I think it should be fixed because it's very confusing for new beginners.