[Solved] Softbody Issue

StrakeFengala
Posts: 3
Joined: Fri Oct 28, 2011 2:47 am

[Solved] Softbody Issue

Post by StrakeFengala »

Greetings, I am new to the forums.

First of all I am very thankful for this project and everyone who has contributed to make it better. I am an OGRE user and I also thank those who have converted ogre mesh vertices to softbodies and back. I can now create a softbody out of any modeled OGRE mesh file.

I am trying to create a long coat to wrap around the legs of a character model approx. 2 units high. I have rigid body capsule objects attached to all of the bones of the character's skeleton to keep the cloth from falling through the character's legs and have anchored the topmost nodes of the robe softbody onto the pelvis rigid body.

The issue I am having is that the softbody's nodes are way too elevated when resting on the rigid bodies making the coat look like a hoopy dress. I have checked with the debugger and made sure that the rigid bodies are not too thick. I know this is the problem because if I scale the dynamics world by about 10 units by resizing all shapes individually it (almost) fixes the elevation problem but causes other problems, to name a couple of them, everything falls like large boulders that gather gravity slowly, and it messes with my kinematic character controllers making them jitter on the ground (possibly my fault somewhere).

Can one change anything related to the softbody or world info to make it more precise or lower the elevation when resting on rigid body objects? Is there a better way to achieve my goal? I could not find an answer to this in the demos. I even tried tweaking random variables that looked like they were related to this (very n00bishly) but to no avail. I have tried both cluster and vertex collision but apparently they have nothing to do with this.

I apologize for the long post, I could not think of a shorter way to explain the problem. If this sounds too confusing or if I did not provide enough information please let me know and I will try to explain better.

Thanks in advance for any advice or information
Last edited by StrakeFengala on Tue Nov 01, 2011 9:00 pm, edited 1 time in total.
StrakeFengala
Posts: 3
Joined: Fri Oct 28, 2011 2:47 am

Re: Softbody Issue

Post by StrakeFengala »

Hah! Just found the solution (I'm pretty sure):

Code: Select all

psb->getCollisionShape()->setMargin(0.001);
I was messing around with the source code and noticed the line:

Code: Select all

m_collisionShape = new btSoftBodyCollisionShape(this);
m_collisionShape->setMargin(0.25);
So I changed it from "0.25" to "0.001" and then the cloth was in fact a lot less elevated from the rigid body bones.

I guess I posted a little too soon but it's here for reference now in case anyone else gets the same problem. Feel free to lock this.
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Softbody Issue

Post by dphil »

Ah darn I should have said something when I first saw your post then. I thought of the margin, but assumed you would have had some default small margin. Indeed, 0.25 is a bit on the large side! Glad you figured it out.