appendAnchor() and scaed rigid body

gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

appendAnchor() and scaed rigid body

Post by gjaegy »

Hi,

basically I am trying to create an anchor to link my soft body and a rigid body.

The rigid body is using a motion state, to synchronize with the 3D object. This 3D object transformation matrix has a scale component, therefore the rigid body also has one.

It seems the anchor point is not attached where I would like it to be, it is actually much higher than both the rigid body and the soft body.

I have noticed the following code:

Code: Select all

Anchor	a;
a.m_node			=	&m_nodes[node];
a.m_body			=	body;
a.m_local			=	body->getInterpolationWorldTransform().inverse()*a.m_node->m_x;
a.m_node->m_battach	=	1;
m_anchors.push_back(a);
The soft body node position is transformed by the rigid body inverse matrix, could this be my problem ? Should I remove any scale component from the rigid body matrix ?

thanks !
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: appendAnchor() and scaed rigid body

Post by Erwin Coumans »

gjaegy wrote: The soft body node position is transformed by the rigid body inverse matrix, could this be my problem ? Should I remove any scale component from the rigid body matrix ?
The rigid body matrix cannot have any scaling, so you have to remove it. Bullet has dedicated local scaling for collision shapes, so you have to move/bake the scaling into the collision shape.

Let us know if this works for you,
Erwin
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: appendAnchor() and scaed rigid body

Post by gjaegy »

Thanks Erwin, this is what I was suspecting.
I solved my issue by applying the scale to the vertices of the mesh (so, pre-transforming the vertices before creating the shape from them), and this seems to work perfectly !