stateManager.attach(bulletAppState) Error [ Resolved ]

Hello all, today i’ve tried to make collision in my scene ^^. And i create a class to make this more quickly. But when i attach an object of BulletAppState on my AppStateManage like this [java]stateManager.attach(bulletAppState);[/java] it gives me an error. JMonkey tell me that the AppStateManager doesn’t have a constructor with BulletAppState in argument. And when i go to the source it’s true i found a mehod for AppState but it’s not include a method for BulletAppState. The strangest thing is that in HelloCollision in the tutorial i can attach BulletAppState to my AppStateManager.

What’s wrong please.

[java]package mygame;

import com.jme3.bullet.BulletAppState;

import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;

import com.jme3.bullet.collision.shapes.CompoundCollisionShape;

import com.jme3.bullet.nodes.PhysicsCharacterNode;

import com.jme3.bullet.nodes.PhysicsNode;

import com.jme3.bullet.util.CollisionShapeFactory;

import com.jme3.math.Vector3f;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

public class collisionGame


//AppStateManager and AppState is included in my package and i modify this for my Application//

private BulletAppState bulletAppState;

private PhysicsNode terrain;

private AppStateManager stateManager;

private PhysicsCharacterNode player;

private Node rootNode;

public collisionGame(AppStateManager stateM, Node rootN){

stateManager = stateM;

rootNode = rootN;

bulletAppState = new BulletAppState();

stateManager.attach(bulletAppState); //Here


public void addTerrain (Spatial s){

CompoundCollisionShape sceneShape =

CollisionShapeFactory.createMeshCompoundShape((Node) s);

terrain = new PhysicsNode(s, sceneShape, 0);




public void addPlayer(Spatial s){

player = new PhysicsCharacterNode(new CapsuleCollisionShape(1.5f, 6f, 1), .05f);




player.setLocalTranslation(new Vector3f(0, 10, 0));









is not a constructor call,it’s just a method call, so the error you report is weird.

Could you post the exact stack trace please?

BTW BulletAppState extends AppState.

Oh yeah i’m sorryso much for me. Yes it’s the method attach of the AppStateManager class where the mistake is.

Is the stack trace no ?


Deleting: C:UsersStomragejMonkeyProjectsEssai N°2 (Sans Application)


Updating property file: C:UsersStomragejMonkeyProjectsEssai N°2 (Sans Application)

Compiling 3 source files to C:UsersStomragejMonkeyProjectsEssai N°2 (Sans Application)buildclasses

C:UsersStomragejMonkeyProjectsEssai N°2 (Sans Application) attach(mygame.AppState) in mygame.AppStateManager cannot be applied to (com.jme3.bullet.BulletAppState)


1 error

C:UsersStomragejMonkeyProjectsEssai N°2 (Sans Application)nbprojectbuild-impl.xml:525: The following error occurred while executing this line:

C:UsersStomragejMonkeyProjectsEssai N°2 (Sans Application)nbprojectbuild-impl.xml:259: Compile failed; see the compiler error output for details.

BUILD FAILED (total time: 0 seconds)

Uh, you didnt implement the AppState interface but created your own class and named it AppState…

Yes it’s true because i’ve want to modify the SimpleApplication and Application that’s why i’ve create my own class with new method ect… But when i’ve want to use the BulletAppState he uses SimpleApplication ect… So it’s why i’ve clone the JMonkey method to rename what it’s wrong. The solution should be to create my own SimpleApplication and Application with this name and not with an other name as what i’ve done.

But thanks for telling me the thruth. Do you have a solution ?

Now it’s ok see my arborescent :slight_smile: :

besides I’m sorry for my basic English.

uh…what are you trying to do exactly implementing your own appstate and Bulletappstate?

I create my own project with my own class. And i recopy and change what i have to change in the class like AppState ect… For example i recopy the class Application in initialiseGame and i change the flycam by a cameraGame and many other things about the initialization of my game. If you want a copy of my Class i can send you the source Package.

Yhea but you DO understand this can’t work right?

the stateManager is waiting for a, not a mygame.AppState.

If you want to change things into the AppState extend it, but do not replace it.

[java]public class MyAppState implements{