public Element(String name, Mesh mesh, Material material){
spatial = new Geometry(name, mesh);
spatial.setMaterial(material);
shape = CollisionShapeFactory.createDynamicMeshShape(spatial);
control = new RigidBodyControl(shape, 0);
spatial.addControl(control);
}
So I’ve created a constructor that makes an object with collision properties in one go, but when I call:
Box box = new Box(width, width, width);
Element thisBox = new Element("Box", box, material);
bas.getPhysicsSpace().add(thisBox.getRigidBodyControl());
rootNode.attachChild(thisBox.getSpatial());
and I translate thisBox:
thisBos.getRigidBodyControl().setPhysicsLocation(new Vector3f(4f, 4f, 4f, ));
The visual seems to move, however, the RigidBody doesn’t seem to follow, and when I do walk into the box, I fall through.
Let me know if you may need to see the complete code: