private BulletAppState bulletAppState;
public static void main(String args[]){
Main main = new Main();
main.start();
}
@Override
public void simpleInitApp() {
//activation phisycs in the scene by addyng a bulletUpState
activatPhisycs();
//initialize the scene and give it the meshCollisionShape
//in this sample, helper class creates a flat floor and drops some cubes and spheres on it.
initializeScene();
//turn on the light
lightOn();
load_AnotherCharacter();
}
public void activatPhisycs(){
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
}
public void initializeScene(){
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
}
public void lightOn(){
AmbientLight light = new AmbientLight();
light.setColor(ColorRGBA.White.mult(2));
rootNode.addLight(light);
}
public void load_AnotherCharacter(){
BetterCharacterControl character_2 = new BetterCharacterControl(2f,4f, 2f);
Node model_2 = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml");
model_2.addControl(character_2);
bulletAppState.getPhysicsSpace().add(character_2);
rootNode.attachChild(model_2);
character_2.warp(new Vector3f(0, 0, 0));
}
I can’t spoon feed you, you need to learn what you are doing and have the determination and ability to figure things out for yourself. Its a steep curve, but if you really want it, you will get there. Personally I don’t think i’m the brightest spark in the bonfire, but I am a very determined character. You need at least one or the other to succeed. If you have both, well you’re in a better position than I am
Don’t cast the oto mesh to a node. It is a spatial:
[java]Node model_2 = (Node) assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);[/java]
That is the spatial i was referring to in my previous post.
But you are able to help me?
I wanna the same result of this:
[java]
public void loadCharacter(){
//set the collision shape
CapsuleCollisionShape capsule = new CapsuleCollisionShape(3f, 4f);
//set the character capsule collision Shape
character = new CharacterControl(capsule, 0.05f);
character.setJumpSpeed(10f);
//load xml.mesh model
model = (Node) assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);
//add control in model
model.addControl(character);
bulletAppState.getPhysicsSpace().add(character);
rootNode.attachChild(model);
character.setPhysicsLocation(new Vector3f(0,0,0));
}
[/java]
NOthing good work !!
You have understand what is the problem here ?
[java]
public void load_AnotherCharacter(){
BetterCharacterControl character_2 = new BetterCharacterControl(2f,4f, 2f);
Spatial otoModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
Node model_2 = new Node();
character_2.setApplyPhysicsLocal(true);
character_2.warp(new Vector3f(0, 0, 0));
model_2.addControl(character_2);
model_2.attachChild(otoModel);
bulletAppState.getPhysicsSpace().add(character_2);
rootNode.attachChild(model_2);
}