Hi Paul,

Thanks for the answer... and thanks for improving osgPhysics by the way of 
discussion.

>> Well, the problem is that physics don't run at the same rate as
>> display.
>
> Then the physics update would run in a separate thread, and you'd need some
> mechanism to "pull" the physics state into OSG during the update traversal.
> I guess I don't understand why this "pull" couldn't be done in the existing
> update traversal.

Well, multithreading *is* an issue, but we need to address the problem.
I guess the order of steps would be:
- When it is time to update the physics, run the "physics update traversal" 
(say "PUT") in a physics thread
- PUT
- PUT
- ...
- When the times come to update the display, lock the physics thread so that no 
PUT runs
- Run the "display update traversal" ("DUT") in a display thread. During this, 
copy physics positions/orientations to transforms.
- Unlock the physics.
- PUT (physics thread), cull and draw (display thread)
- and so on.

Am I right? I'm not sure about threads because here the PUT cant run when DUT 
runs, so the interest is limited, even if cull and draw steps would be in 
parallel of a PUT. Maybe there could be improvements. Any idea?


>> > You can always fire off custom traversals from the existing traversals.
>>
>> Hum... do we need to modify the viewer source? I guess so...
>
> I think what Robert is talking about is something like launching a physics
> simulation step from a root node update callback (for example). This doesn't
> require modifying osgViewer. But I don't think this would satisfies your
> requirement to run the physics simulation at a different rate from the
> display.

Well, is it possible to run "n times PUT", and then one time the standard frame 
(update/cull/draw)? If so, there should be no problem.
For now, physcs objects are updated "manually", by calling something like "for 
each object { object->update(); }" because all objects are known by a single 
class (the "World"). The PUT could simply be that kind of loop (instead of a 
full traversal)... what is the best design, according to you?

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to