Sign in to follow this  
yeisnier

PhysX Sleeping Behavior

Recommended Posts

yeisnier    122
I have a problem with PhysX where objects dont' want to go into sleep or delay forever to do so As I'm working with 1 unit = 1 centimeter instead of the PhysX metric of 1 unit = 1 meter, I have set: pPhysicsSDK->setParameter(NX_SKIN_WIDTH, 10.0f); pPhysicsSDK->setParameter(NX_DEFAULT_SLEEP_LIN_VEL_SQUARED, 99*99); pPhysicsSDK->setParameter(NX_DEFAULT_SLEEP_ANG_VEL_SQUARED, 99*99); pPhysicsSDK->setParameter(NX_DEFAULT_SLEEP_ENERGY, 99); and for each dynamic actor: pNxActor->raiseBodyFlag(NX_BF_ENERGY_SLEEP_TEST); pNxActor->raiseBodyFlag(NX_BF_FILTER_SLEEP_VEL); With that setup if an object speed gets below 99 it should get into sleeping (99 is a big value just for testing) In my scene I create 2 dynamic boxes and let it fall into another static box. The dynamic boxes start jittering and never fall sleep even given that they don't contact each other. My wonder is that in every frame I printed the linear and angular speeds of both boxes and they are bellow the 10 magnitude so the PhysX setup should put them into sleep, however they are really Awaked!! for more testing, I raised the 99 in the linear and angular default sleep parameter even more into 99999999*99999999 but nothing happens. Am I missing something?

Share this post


Link to post
Share on other sites
yeisnier    122
I found that by adding

pPhysicsSDK->setParameter(NX_BOUNCE_THRESHOLD, -100);

the objects get into sleeping mode as expected. However that seems a hack to me because with the previous settings they should go into sleeping.
I checked that I'm not applying forces or making changes to the scene that could wake them up. The PhysX material I'm using for the scene have a restitution of 0.5

Share this post


Link to post
Share on other sites
LilBudyWizer    491
I don't know PhysX but it seems to me the sleep would only apply in limited circumstances. If you threw an object straight up then at it's peak it's velocity is zero. So if it applied universally objects would get stuck in the air.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this