Random RuntimeError
I don't know when but probably while removing an Avatar from the world I get a RuntimeError.
Code:
Traceback (most recent call last): Could this be the cause? and how could i solve it? |
You could try preloading all models. For another project with a lot of avatars, I just preload one and clone() that one when I need a new one. That is instant.
Using the director is tricky... |
I'm already preloading the avatars, but I still need to initialize the code around the avatar, this involves creating some additional helper object on the avatar together with some other time consuming code. In all it takes between 5 to 7 ms to construct an avatar making loading even 1 avatar per frame noticeable. Using the director method it take 70 ms but the framerate is influenced a lot less. I assumed the async methods of Vizard would work well with Vizard?
|
Most Vizard commands are not thread safe, especially when it comes to adding/removing objects from different threads. The viz.director function mainly exists for backwards compatibility reasons, and is only intended to be used to perform non-Vizard related operations (e.g. file/socket IO).
Having said that, loading models in director threads can work. You just need to be very careful not to add/remove other models while the asynchronous operation is being performed. Additionally, the model should be added to a dummy scene when being loaded asynchronously, to avoid adding the model while the active scene is rendering. Vizard 5 will have built-in support to load models/avatars asynchronously, and all the threading issues will be handled automatically. |
When i want to load the model in a different scene how can I set the scene of the object back to viz.MainScene? There doesn't seem to be a setScene function on Node3D objects.
|
The node.setParent command can be used to reparent a node to another scene:
Code:
node.setParent(viz.WORLD, viz.MainScene) |
When setting the parent do all the children of the node you re-parent also get transferred to the new scene?
And adding children to a node that is in a different scene do they get automatically relinked to that scene? |
Yes, when you set the parent of the node, all children of that node will be moved to the new scene.
|
All times are GMT -7. The time now is 08:08 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC