Hi everyone,
are these parameters in seconds or in milliseconds? Its not clear for me.
Hi everyone,
are these parameters in seconds or in milliseconds? Its not clear for me.
Hi,
these are in seconds, will update the doc, good point.
Btw if you are looking for a way how to completely control physics simulation stepping independently you can use physx_simulation_interface instead, the full loop would look like this:
cache = UsdUtils.StageCache.Get()
stage_id = cache.GetId(stage).ToLongInt()
get_physx_simulation_interface().attach_stage(stage_id)
for i in range(num_steps):
get_physx_simulation_interface().simulate(1.0/60.0, i * dt)
get_physx_simulation_interface().fetch_results()
get_physx_simulation_interface().detach_stage()
Thanks for reporting.
Regards,
Ales
Hello,
Thank you for the clarification.
I do indeed need a way to control the physics steps.
Do I always have to call the attach_stage and detach_stage methods? What happens without them?
And do I need to configure the PhysicsScene component in a certain way for this to work?
The attach_stage function will parse USD and add objects into PhysX so that you can simulate. Same happens when you press play.
Detach_stage will then release objects from physx, so once done simulating you should release those objects.
Using the above gives you full control over simulation so you have to make sure things are loaded into physics.
Regards,
Ales
I tried the code you provided, but with a physical step size of 0.002 seconds. The fetch_result() method takes about 16 ms in this case. Are these normal times? My scene is not really big and I am a bit concerned about the 16 ms time to fetch the results, which is basically a blocking call.
Thats quite large number indeed, but there are many things that can be slow by default. The default settings are the slowest but should work in all cases.
So there are in general two things that slow down the simulation significantly:
Regards,
Ales
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.