# Orientation problem on object attachment

This topic is 2606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

This is a warehouse scenario, first a warehouse operator attaches to a hand trolley.
The attachment is fine, the method i use is to create a transformation matrix that follows the hand combined transformation matrix, the trolley attach point is also the child of this combined transformation matrix. During update of the trolley, I check the value of this transformation matrix and concatenate it to the world matrix of the operator. The problem is when the operator is walking in opposite direction, the trolley will appear up-side down (in the air). I notice this is because the trolley's transformation is equal to the combined transformation matrix of the hand, it would follow the hand movement. I am seeking for a solution that will allow the trolley to stay on ground all the times. Any pointers would be appreciated...
Let's see some code
 void AttachToOperator(CrowdEntity* pObject, char* Name) { FrameEx *root = (FrameEx*) pObject->GetFrameRoot(); m_pOperator = dynamic_cast<COperator*>(pObject); // Save a reference to the operator if (root != NULL) { FrameEx *f = (FrameEx*) D3DXFrameFind(root, Name); if (f != NULL) { m_pCombineFrameMatrix = &f->matCombined; m_Mesh.SetParent(f, "Handle", 1.5f); } } } ///////////////////////////////// // Set parent is very ugly void CMesh::SetParent(LPD3DXFRAME pFrame, char *Name, int size) { LPD3DXFRAME f = D3DXFrameFind(GetFrameRoot(), Name); pFrame->pFrameFirstChild = new D3DXFRAME(); pFrame->pFrameFirstChild = f; FrameEx *f2 = (FrameEx*) pFrame; FrameEx *f3 = (FrameEx*) f; f3->matCombined = f2->matCombined; f3->matCombined._11 = size; f3->matCombined._22 = size; f3->matCombined._33 = size; } 
Thanks
Jack

##### Share on other sites
Don't know why I cancel out all combined matrix values to identity except 41 42 43, the trolley is sometimes upside-down. Something to do with the right-hand-rule? Not too sure Any ideas? Jack

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633742
• Total Posts
3013636
×