"Hard" attaching soft body node to a rigid body.

Post Reply
Saso222
Posts: 5
Joined: Fri Oct 17, 2014 12:14 pm

"Hard" attaching soft body node to a rigid body.

Post by Saso222 »

Hello everyone,

I've having some head ache with this trouble. I want to simulate the physic behaviour of a character inside my game.

I'm using Ogre + Bullet with my own wrapper, taking some ideas from btOgre.

Right now, I'm trying to make a cloak simulated with a SoftBody. I achieved to create the SoftBody from an Ogre mesh and now I'm just trying to attach it to the character's shoulders. I did this:

Code: Select all

	mCloakBody->appendAnchor(0, m_bodies[BODYPART_LEFT_SHEATH]);
	mCloakBody->appendAnchor(100, m_bodies[BODYPART_LEFT_SHEATH]); 
Where, obviously the m_bodies array is where I store the rigid bodies.

But with this approach my cloak is like attached to two ropes that are attached to the rigid body at some distance. So the SofBody flies around the character.
ScreenShot.png
ScreenShot.png (515 KiB) Viewed 6626 times
Is there any way to attach the vertex of the SoftBody to a vertex of the RigidBody in such way that the SoftBody vertex moves instantly with the RigidBody?

Thanks in advance.
turanszkij
Posts: 6
Joined: Sun Mar 16, 2014 8:17 pm

Re: "Hard" attaching soft body node to a rigid body.

Post by turanszkij »

For that cloak you probably don't need to attach it to the rigid body. If you have a skeletal animation to your character, you can also animate the attached vertices of the cloak the same way, and it even moves with the shoulders that way.
First you should set the soft body node's mass to zero, that way it won't be calculated by Bullet.
Then you should update the nodes' positions like you do your animation for the character every frame, and step the physics world.
That is how I do it anyway.

If you don't have an animation system yet, you could just transform the zero-mass nodes by the character transformation (or the rigid body transformation).

You can check out my version here: https://www.youtube.com/watch?v=yLQXmm5Q5zs
Saso222
Posts: 5
Joined: Fri Oct 17, 2014 12:14 pm

Re: "Hard" attaching soft body node to a rigid body.

Post by Saso222 »

Hi,

Thank you for your quick answer.

That youtube link is awesome, you achieved exactly what I want.

I don't have skeletal animation and, since this is a school project, I won't have it. I've tried what you said about transform the zero-mass nodes, moving them each frame, setting their position to the position of the shoulders' rigid bodies. But if I do that only with the two points i'm "appending" to the rigid bodies, the softBody is getting stretched, and the triangles of the superior corners are huge. Screenshot:
ScreenShot2.png
ScreenShot2.png (703.2 KiB) Viewed 6547 times
That's obviously not what I want.

I tried to translate all the nodes an offset so they all move the same, but this is what I get:
ScreenShot3.png
ScreenShot3.png (765.67 KiB) Viewed 6547 times
The offset of the position of all the nodes is calculated using the left shoulder's bone, so the cloak is only attached in that point. I can't think of a way to make the cloak be attached to both shoulders.

Thank you.
ericking
Posts: 3
Joined: Tue Jul 16, 2019 10:14 am

Re: "Hard" attaching soft body node to a rigid body.

Post by ericking »

@Saso222 ,hi
I had same problem, can you provide details solutions?
thanks
Post Reply