# Control bone as cloth.

Hello everyone.

I want to create a cloth.
But I don’t want to program the meshes with PhysX.
So I has an idea to attach bone to the cloth and control the bone programically.(controlJoint())

The frist step algorithm is very simple.

I test it in 3 planes(XY , YZ , ZX)separately and it’s work as I want.
But when I combine them together the Hpr rotation not work and I understand why it’s not work.
At first I think when rotate the object around each axis will not effect to the other rotation, But it’s not.

as you already noticed. the order in which you rotate your model is critical. using vectors and let panda rotate it to point into the direction is probably a better idea than manually calculating the hpr-values.

hpr’s are not really suited for this task anyway.
you’r probably better of to store the bone’s last position, relative to itself, move that a bit down (along gravity). and then have the bone lookAt() that point.

although there is a really nice theory describing such motion accurately, simply having it looking at it’s last center-of-mass-point might be a cheap and good-looking trick. i have not tested this,thought. but maybe you’r lucky with it.

But I have test something.
I move the nodePath (node1) around the origin point on plane ZX (rotate around Y axis).
And that node1 alway lookAt the origin.

When I print out node1.getP() the value is so weird.
It return 0 -> 90 -> 0 -> -90 -> 0.
(But I want 0 - 360)

I try node1.lookAt(Point3(0,0,0),Vec3(0,1,0))
But it still print out the same result.
Any idea?