A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by PJani » Wed Feb 10, 2010 4:59 pm
I have pointer to one body how can i get full tree of joined bodies. So i can set position of full object not only of one body.
Example what i mean. If i want to move vehicle then i need to know which bodies are joined to that body chassy or else i will get exploded vehicle when setting position.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
-

PJani
-
- Posts: 448
- Joined: Mon Feb 02, 2009 7:18 pm
- Location: Slovenia
by JernejL » Wed Feb 10, 2010 6:18 pm
NewtonJointGetBody0
NewtonJointGetBody1
Sometimes it really is that simple

-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by PJani » Wed Feb 10, 2010 10:33 pm
These two function are helpful when i have joint pointer. but i dont!! I have only base body pointer!.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
-

PJani
-
- Posts: 448
- Joined: Mon Feb 02, 2009 7:18 pm
- Location: Slovenia
by Julio Jerez » Wed Feb 10, 2010 11:39 pm
you will need to use a tree walk using the functions GetFirstJoint() GetNextJoint() something like this
- Code: Select all
void GetJointForest (newtonBody* root, containet bodyList)
{
MyUserData = NewtwonGetUserData(body)
if (! MyUserData->FourestFlag()) {
bopdyList.Push (body)
// set a f;ag in teh user data of you body
MyUserData->SetFlag (1);
for (joint = NetwopnGetFirstJoint(body); joint; joint = NetwonGetNextJoint (body, joint))
{
if (joint->GetBody0() != body) {
GetJointForest (joint->GetBody0() , containet bodyList)
} else {
GetJointForest (joint->GetBody1() , containet bodyList)
}
}
}
}
I hope you get the idea
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by PJani » Fri Feb 12, 2010 12:21 am
Yep that i was looking for, god bless 2.x this this was lack of in 1.5x

! thank you

| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
-

PJani
-
- Posts: 448
- Joined: Mon Feb 02, 2009 7:18 pm
- Location: Slovenia
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 201 guests