I was trying to use this code to create 2 differents box (2 floors in fact).
It was working great, except for one thing. It was always transparent, there was no way I could put color or texture on it.
Like this:
this.plancher = this.getPhysicsSpace().createStaticNode();
this.rampelancement = getPhysicsSpace().createStaticNode();
this.rootNode.attachChild(this.plancher);
this.rootNode.attachChild(this.rampelancement);
PhysicsBox formePlancher = this.plancher.createBox("plancher");
formePlancher.setLocalScale(new Vector3f(PLANCHER_LONGUEUR, PLANCHER_EPAISSEUR, PLANCHER_LARGEUR));
PhysicsBox formeRampe = this.rampelancement.createBox("rampelancement");
formeRampe.setLocalScale(new Vector3f(1, PLANCHER_EPAISSEUR, 1));
rampelancement.getLocalTranslation().set( 0, 1, 0 );
formePlancher.setMaterial(Material.WOOD);
formeRampe.setMaterial(Material.WOOD);
The only way I found to put some color on it, like a real objet, was to change createbox for new box and then attach this "new box" to the staticnode.
Is it the right thing to do? What is the difference between createbox and new box() ? It seems my floor physics is not the same since I made the change, even if I keep the same material (wood)
It's probably a newbie question but I couldn't find a clear answer on the forum
this.plancher = this.getPhysicsSpace().createStaticNode();
this.rootNode.attachChild(this.plancher);
Box formePlancher = new Box("plancher",new Vector3f(),PLANCHER_LONGUEUR, PLANCHER_EPAISSEUR, PLANCHER_LARGEUR);
this.plancher.attachChild( formePlancher );
Box formeRampe = new Box("rampelancement", new Vector3f(), 1, PLANCHER_EPAISSEUR, 1);
this.plancher.attachChild( formeRampe );
formeRampe.getLocalTranslation().set( 0, 1, 0 );
this.plancher.setMaterial(Material.WOOD);
this.plancher.generatePhysicsGeometry();
Thanks for your help!