Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use </p> <pre><code>NxActor::putToSleep(); </code></pre> <p>on startup. This will dramatically increase scene performance. However, if there are misplaced objects on your stack (i.e. a flying cube) it won't fall down until some another dynamic objects hits on it.</p> <p>This approach does not seem to work on actively moving objects. For example if my dynamic object is moving with speed 5m/s on my scene and if I try to force it to sleep, putToSleep won't work (even if I make set the velocity of the object to 0 first, then put it to sleep)</p> <p>Here is a workaround to if you need to force sleep and disable a dynamic actor.</p> <pre><code>void setDynamicActorState(NxActor&amp; actor, bool disabled) { if (nxActor.getNbShapes() &gt; 1) { for (int i = 0; i &lt; nxActor.getNbShapes(); i++) { nxActor.getShapes()[i]-&gt;setFlag(NX_SF_DISABLE_COLLISION, disabled); } } else { if (disabled) nxActor.raiseActorFlag(NX_AF_DISABLE_COLLISION); else nxActor.clearActorFlag(NX_AF_DISABLE_COLLISION); } for (int i = 0; i &lt; nxActor.getNbShapes(); i++) { nxActor.getShapes()[i]-&gt;setFlag(NX_SF_DISABLE_SCENE_QUERIES, disabled); } if (disabled) { nxActor.raiseBodyFlag(NX_BF_KINEMATIC); nxActor.putToSleep(); } else { nxActor.clearBodyFlag(NX_BF_KINEMATIC); nxActor.wakeUp(); } } </code></pre> <p>This will disable everything for the actor, collisions, scene queries etc. I use this strategy to preload all actors to the scene and to hide inactive objects. When their turn comes, enable them, disable others. Beware that loading all actors at once may consume the memory.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload