I have a setup with some walls, up to 6 walls form a Cellnode (class node) that acts as the parent of the walls. Now i want to set up those walls as solid – in real, this is of course a routine doing this with all walls –
[java]
public void setWall(ImageID imgID, DIR cd, boolean hard)
{
// this returns an AbstractBox-derived Mesh. In principle
// it is a box that can have 0-6 walls (well, in fact up to 8, but
// lets stay 3D) and you can configure for each if it is
// the inside or outside and give them arbitrary offsets…
// without ‘addControl’, it works pretty well.
CellMesh wall = super.setWall(imgID, cd, null);
// this sets up my testing RBC
RigidBodyControl r = new RigidBodyControl(0.0f);
if (wall.hasOne())
{
// walls obj-param is assured to be the Geometry
Geometry geom = (Geometry) wall.getOParam();
// now this line causes the problem
geom.addControl(r);
ManagedApplication.getPhysics().getPhysicsSpace().add(r);
return;
}
ManagedApplication.getPhysics().getPhysicsSpace().remove(r);
}
[/java]
So the problem is: as soon as i execute geom.addControl®, my up till there in correct placement setup walls all return to the origin, just offsettet by their relation to Cellnode, so it seems that this command moves the cellnode (walls parent) back to the origin. cellnode has been moved with the move()-command for this node.
To test if this has something to do with my CellMesh, i’ve temporarily rewritten the fn to the following:
[java]
// (…)
if (wall.hasOne())
{
// i create a new box-shape…
Geometry geom = new Geometry("", new Box(0.5f, 0.5f, 0.5f));
// …give it a green hue…
geom.setMaterial(Manager.getColormark(ColorRGBA.Green));
// …and move the box to the center of the CellNode node.
node.attachChild(geom);
// if i leave out the following line, i get one green box at the center of
// each cellnode, but if i execute it, i get all green boxes at world's origin.
geom.addControl(r);
ManagedApplication.getPhysics().getPhysicsSpace().add(r);
return;
}
// (…)
[/java]
While the change moves the green boxes, the walls stay in place, so it does not move CellNode but allways the object it is added as control. Is this just gravity to the supermassive Black Hole at sector 0/0/0 or what could cause this behaviour…?