Colored Ragdoll - Unsolved

Hey guys!



I’m trying to edit creatLimb Method to add color to the ragdoll’s limb. But i’m not getting success with it. Here’s my code (p.s.: I edit the code to create box limbs and not cylinder limbs).



[java]private Node createLimb(float width, float height, Vector3f location, boolean rotate, ColorRGBA color) {

int axis = rotate ? PhysicsSpace.AXIS_X : PhysicsSpace.AXIS_Y;

CapsuleCollisionShape shape = new CapsuleCollisionShape(width, height, axis);



Node node = new Node(“Limb”);



RigidBodyControl rigidBodyControl = new RigidBodyControl(shape, 1);

node.addControl(rigidBodyControl);



mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat.setColor(“m_Color”, color);



node.setMaterial(mat);

node.setLocalTranslation(location);

return node;

}[/java]



Hope you guys can help me please.



Thanks in advance, borba.

Sorry for bumping the topic, but I still need help. Does anyone knows how to do it?



Thanks in advance, borba.

You don’t even have a Geometry attached, your Node cannot have a color.

Thanks for your reply, normen.



Normen, I don’t want to loose the Capsule shape, so it’s not posible to do:

[java]Geometry geom = new Geometry(“Limb”, shape);[/java]

cause Geometry expects a Mesh and “shape” is a CollisionShape.



I’m doing this wrong, but I don’t have any ideas on how to fix this.

I’ve already looked in many tutorials and looked at the docs.



Thnks in advance, borba.

Man, its the debug display you see. Your whole scene is invisible. If you dont want to use Geometry then you will have to imagine your game while playing it.

Normen, I think this is a misunderstanding.



What I mean is that I want to use Geometry, but Geometry needs a Mesh and CollisionShape isn’t a mesh. And, CapsuleCollisionShape has the shape of a capsule and I want to use this kind of shape. But, if I change it to a Cylinder, I’ll loose the capsule shape, ad will have a cylinder shape.



And besides that, even if I want to use a cyinder, createLimb uses float values and to create a Cylinder I need int values.

So create a new Cylinder mesh…

new Cylinder(int axisSamples, int radialSamples, float radius, float height)

createLimb uses float values and to create a Cylinder I need int values.

new Cylinder(int axisSamples, int radialSamples, float radius, float height)

Thanks for you reply.



C’mon guys, I know this is simple for most of you. I just want to put some color on my ragdoll.

I’m editing the method from tutorial, but Everytime I try to make a simple ragdoll using Boxes, Cylinders, etc. it jsut gets all messed up!

Please, I really don’t know what to do right now. I really need this.

Normen gave you the answer, what else do you need?.

create a cylinder, attach it to your node and set the material on it.

Thanks for your reply, nehon.



Okay, I’ve manage to add color to the ragdoll, but Now the lower arms seems to be dancing. It starts shaking around… And the arms can go to the ragdoll’s back. Any solutions?



Thanks in advance.