Hi, all. I know this has been a problem for awhile, but I don’t know if there have been any fixes (I didn’t need to bother with it until now)… So, as the title says, my object sinks into the scene http://imgur.com/kJT2w.png
My code:
[java]private void createTerrain() {
terrain = (Node) assetManager.loadModel(“Scenes/mapandclimbmeshh.j3o”);
terrain.setLocalTranslation(new Vector3f(-150,0,0));
terrain.setLocalRotation(PITCH090);
terrain.scale(2);
terrainPhysicsNode = new RigidBodyControl(CollisionShapeFactory.createMeshShape(terrain), 0);
terrain.addControl(terrainPhysicsNode);
//terrain.setShadowMode(ShadowMode.Receive);
rootNode.attachChild(terrain);
getPhysicsSpace().add(terrainPhysicsNode);
}
private void createCharacter() {
Box b = new Box(Vector3f.ZERO, 0.5f, 0.5f, 0.5f);
Geometry geom = new Geometry(“Box”, b);
geom.setLocalTranslation(0, 0, 3);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTexture(“ColorMap”, assetManager.loadTexture(“Textures/BrickWall.jpg”));
geom.setMaterial(mat);
CapsuleCollisionShape capsule = new CapsuleCollisionShape(3f, 4f);
character = new CharacterControl(capsule, 0.01f);
model = (Node) assetManager.loadModel(“Models/Oto.mesh.xml”);
model.attachChild(geom);
//model.setLocalScale(0.5f);
model.addControl(character);
//model.setShadowMode(ShadowMode.CastAndReceive);
character.setPhysicsLocation(new Vector3f(-150, 65, -10));
character.setJumpSpeed(35);
rootNode.attachChild(model);
getPhysicsSpace().add(character);
getPhysicsSpace().enableDebug(assetManager);
}[/java]
What did I do wrong this time
-NomNom
maybe your triangles are too big, and that mass looks pretty small, increase it and see what happens
Sweet, that worked! And now I feel like a total noob >.< lol… Thanks!
-NomNom
Uh, there is no mass in that code except the mass for the terrain, which correctly is 0 :?
Gah, I keep forgetting that’s not mass, it’s stepHeight!!!(I thought wezrule was referring to the number variable in the CharacterControl creation part… Which I increased to 1, and it now works)… Well, whatever it was, it works now (however, raising that number seems to have the same result as increasing the mass).
-NomNom
yeh I mean’t step height