for the new physics unity system? I can’t find anything else on this
May I add that I’m trying to get rid of jitteriness in a pile of entites with physics shapes & bodies
for the new physics unity system? I can’t find anything else on this
May I add that I’m trying to get rid of jitteriness in a pile of entites with physics shapes & bodies
There’s no states on the Unity Physics, meaning there isn’t sleep states either.
I’m not sure what it would have to do with states.
I imagine the way you would achieve this effect is to have a system that checks an entity’s velocity is below a certain ‘sleep threshold’ and to remove/set its physics body component.
I was wondering if there was already something that basically does that
You can’t just sleep object the moment it’s velocity is near zero, it can do that momentarily while changing direction too.
That’s true - although I think the rationale still stands. How would you go about achieving the desired effect i outlined?
What about checking if an entity has not recieved a force greater than a threshold for a certain amount of consecutive frames?
I’d imagine one could just have some float that tracks how long the object has been under some velocity threshold and once some time threshold is reached, it would get sleep tag component which would omit it from rigidbody simulation itself.
But you can’t get huge gains from this though as you can’t optimize the actually taxing part of physics sim which is the broadphase, you still need to keep tracking the slept rigidbodies there and can’t group them in bigger boundaries to reduce the perf hit (like done in physics engines normally) without major rework.
All in all, I feel that sleeping isn’t implemented because the parts that are trivial to implement for it will not give you notable perf gains + all quick hacks still go against the idea of the physics engine being stateless.
Ok, thanks.
I didn’t really consider this for performance gains. I was getting undesirable visual effect of 100s of rigidbodys jittering whilst being in close proximity/touching eachother (their colliders dont appear to be overlapping) How i understand it is that the rigidbodies are perptually sending impulses to eachother. Is this something that will get ironed as the new physics gets refined?
Not being able to stack a ton of rigidbodies is a known limitation of Unity Physics, you can use Havok Physics to overcome this.