Algoryx / AGXUnity

AGX Dynamics Unity 3D plugin
Apache License 2.0
70 stars 19 forks source link

Reset instance to initial state #154

Open dariooo512 opened 7 months ago

dariooo512 commented 7 months ago

I'm studying how this library works and I'm facing a situation where I Need to reset the position of a robot after some conditions.

I see that in an example to achieve this, the object gets destroyed and recreated as such:

if (robot != null)
    DestroyImmediate(robot);

Simulation.Instance.Native.garbageCollect();
m_isDisabled = false;
robot = Instantiate(Resources.Load<GameObject>("IRB6700_220_265_SW6_LeanID"));
InitializeRobot();

I can't use this approach due to performance issues, is there any proper way to implement this?