Kinematic don't sleep?

Hi.

Today I encountered a strange problem with physics. Thanks to the new debug tools @Normen provided, I easily saw that most of my objects are not sleeping.

What I do is the following :

  • send some projectile
  • wait for collision with ground
  • promote it to “building” : remove the floor from collision groups, set it to kinematic and clear forces/speeds.

Some of my buildings are even batched after landing to speed the things up.

After a few minutes, all of my “buildings” are still active, except those that don’t touch the floor (some kind of balloon; they do become sleeping as expected).

Any idea on what I do wrong ?

I have also this message : “warning CollisionDispatcher.needsCollision: static-static collision!”
Is it related ?

Any advice is welcome.

“Inactive” means no physics forces are calculated for the object, this never needs to be done for kinematic objects so theres nothing they have to deactivate :slight_smile:
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless theres emotes that hint otherwise or there’s an increased use of exclamation marks and all-capital words.

Ok, right. I do understand this. However it’s not what I observe.

I just did two comparable runs (not exactly the same because of some randomness) :

  1. with setKinematic(true)
  2. with setMass(0)

After throwing 10 buildings, I reset the profiler and let it run for 10 seconds.

  1. around 20-30 fps
  2. around 150 fps

The profiler gives me :

  1. internalSingleStepSimulation from DiscreteDynamicsWorld consumes 79.9% of CPU time (77.7% in processCollision)
  2. internalSingleStepSimulation from DiscreteDynamicsWorld consumes 1.9% of CPU time

What do you think of that ?
(I used latest Nightly build)

Well an object with mass=0 is not even expected to be moving, so there isn’t even tracking of its velocity or anything. Even simpler, still nothing to do with “active” :slight_smile:
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless theres emotes that hint otherwise or there’s an increased use of exclamation marks and all-capital words.

Ok, thanks for the input.

To summarize :

  • mass=0 => should not move => very efficient
  • kinematic => no force but still some dynamics computed (even with mass=0) => always “active” but does not mean anything
  • otherwise => force-driven objects if active, switch to inactive if not moved for some time

That’s interesting. I did not understand that.

A last question : Is a zero-mass object unable to move ? Or is it allowed, but may have nasty side-effects ?

Yeah, moving a zero-mass object will not yield proper collision results as neither the speed nor the mass is known for these objects. You can place the objects but you should not expect proper collision results when you move them. If you actually find out about strange differences or actual high computing due to kinematic nodes then make a test case and I’ll look into it but there really shouldn’t be any.
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless theres emotes that hint otherwise or there’s an increased use of exclamation marks and all-capital words.