A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Julio Jerez » Wed Nov 15, 2017 3:03 pm
Oh I see you are using different worlds,
for what I can see you are setting the initial condition on each frame or every few frame kind of lie a lockstep multiplayer game. I support that will work.
Try and let me know what you get, the only thing I can see if that it will be slower since contact cache coherence will be lost, but if the scene is small then that fine.
as long as you set all the parameters of the body the it should be fine.
After your get you first joint set up and running, if you get problems let me know it may be possible to take that special condition and use it in your own joint.
Is the reason you are doing that way because your system in multiplayer?
there are few people who do use multiple works susesfullt, but I do not know who they do it.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by eabbink » Wed Nov 15, 2017 5:57 pm
Yes, exactly, we set the initial condition for each frame, because the condition in the world might not be the most recent.
We do this because the application runs multithreaded, with the simulation running in one thread and possible users of the simulation state are running in other threads. With the rotating buffers there is always the most recent state available with a read lock request and a state available for writing through a write lock request. We use 3 instead of 2 as the read and write locks may be held for different amount of times.
Doing it this way means we don't have to zealously guard which calls at what time other parts of the code can or cannot call. A read lock request will give a const object which can be used for querying anything, but cannot be changed. A write lock request will provide the simulation thread (and only the simulation thread) with an updateable object without any interference with callees from other threads asking for state information.
We probably could share the newton world and bodies between our state buffers, but each having their own seems cleaner.
Will let you know how it goes with joints in this scheme.
-
eabbink
-
- Posts: 21
- Joined: Wed Jun 21, 2017 6:32 am
by Julio Jerez » Wed Nov 15, 2017 6:50 pm
just remember normal Joints do not have internal states. It all depend of the value of the two linked bodies.
and finally use the dCustom Joints, the internal Joint are a legacy the has not been updated in years.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by eabbink » Sun Nov 19, 2017 7:17 pm
we use dCustomBallJoint for the hitch. I've added synchronisation of joint creation/deletion and it seems to work perfectly. (So when the trailer is hitched in world #1, before updating world #2 the joint gets created there as well.)
Thanks for the help!
-
eabbink
-
- Posts: 21
- Joined: Wed Jun 21, 2017 6:32 am
by Julio Jerez » Sun Nov 19, 2017 10:04 pm
cool! can you make a small video?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- 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 9 guests