A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Adversus » Tue Nov 08, 2011 8:16 am
Is there a way to do this?
-
Adversus
-
- Posts: 29
- Joined: Tue Oct 12, 2010 8:39 am
by Julio Jerez » Tue Nov 08, 2011 8:48 am
There are more than one way.
the easier is to iterate over the body list calling function
- Code: Select all
for (body = NewtonWorldGetFirstBody (world); body; body = NewtonWorldGetNextBody (world, body); {
int sleepState = NewtonBodyGetSleepState(body);
....
}
a more complex but more elegant and efficient way it to keep track when they become active by checking on the force and torque call back.
basically you can keep a counter and in the force callback you increment the counter if the body is active and decrement if is sleeping.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Adversus » Tue Nov 08, 2011 1:31 pm
Thanks the easy way is fine.
It's for non-performance critical debugging.
-
Adversus
-
- Posts: 29
- Joined: Tue Oct 12, 2010 8:39 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests