A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Slick » Mon Dec 09, 2013 4:53 pm
dBody is returned NULL from Getuserdata. I don't think that I have even used setuserdata that would set it to an invalid value.
Could it be a thread issue?

- 12-9-2013 12-42-42 PM.png (67.81 KiB) Viewed 2847 times
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Slick » Mon Dec 09, 2013 5:03 pm
I tried m_World->SetConcurrentUpdateMode(FALSE); to disable threading and it seems to be ok.
I am guessing it is related to me destroying a body but the thread isn't synched that it is destroyed? Is there a standard way to destroy bodies to avoid thread issues?
I could be wrong about the cause and will test more.
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Julio Jerez » Mon Dec 09, 2013 5:23 pm
did you call WaitForUpdateToFinish(); before you delete the body?
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Slick » Mon Dec 09, 2013 5:36 pm
No I don't think so. Should you call that before every deletion on a body? That would be a lot of calls throughout code but maybe required?
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Julio Jerez » Mon Dec 09, 2013 6:24 pm
the end app has to do it because the the call is not reentrant, if I call it and soem one else callit, it will lock indefinittle.
you should not call that after every frame because it defeet the purpose of asyncronous update.
in the demos there are some example of how I use it.
for example when you hit space key, for spawing a body, or when hitting the F3 key.
look at function void DemoApplication::OnRenderUpdateEnd(dFloat updateParam)
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Slick » Tue Dec 10, 2013 12:59 pm
Yep I understand to not call every frame.
Does this mean whenever you create or destroy a body you should call WaitForUpdateToFinish(); ?
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Julio Jerez » Tue Dec 10, 2013 1:49 pm
yes.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Slick » Tue Dec 10, 2013 3:32 pm
Would it make sense to put the waitforupdatetofinish call in the constructor and destructor of OgreNewtonDynamicBody/OgreNewtonScenebody etc?
-
Slick
-
- Posts: 330
- Joined: Sat Feb 07, 2004 7:24 pm
- Location: LA last and France now
by Julio Jerez » Tue Dec 10, 2013 5:43 pm
not because when the contructor and destrucotr are called the base class is already called,
so that will do nothing because the NewtonBody is create in the base class
it sodul not be that complicated.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 4 guests