[discuss]CollisionObject sleep even when already collide with another CO, wake on further new collisions

Hello, i want to share my solution and discuss if anyone got better solution - like topic say its about sleep mode on scene load

my solution(works as expected):

step 1(init):

rigidBodyControl.setContactResponse(false);
rigidBodyControl.setGravity(Vector3f.ZERO);
rigidBodyControl.setCollisionGroup(PhysicsSystem.COLLISION_GROUP_ALL);
rigidBodyControl.setCollideWithGroups(PhysicsSystem.COLLISION_GROUP_NONE);

step 2(after time to make CO sleep)

rigidBodyControl.setContactResponse(true);
rigidBodyControl.setGravity(gravity);
rigidBodyControl.setCollideWithGroups(PhysicsSystem.COLLISION_GROUP_ALL); 

so after step 2, can just collide it with player or anything else:

Question:

is there any way to just set “sleep-mode” for rigid bodies(or just anything) until it collide with moving CollisionObject?

Currently using Minie 1.6.0 and i dont see method like “setSleep”. and setting “setSleepingThresholds” bigger dont help(if object is already “within other object CollisionShape” it will not just stay there for this case.)

So i made solution like above that works, bit its just very tricky.

Goal is to have same behaviour like for example in Fallout game, where only “touched” objects awake from sleep mode.

If anyone have better solution, please share.

1 Like

Sleep mode (aka deactivation) is intended as a performance optimization, not a mechanism for collision detection.

Minie provides several mechanisms to detect collisions. My first instinct would be to use `PhysicsSpace.addCollisionListener()’.

Ignoring the collision with the ground shouldn’t be difficult.

“Ignoring the collision with the ground shouldn’t be difficult.”

Its not about ignoring terrain collision, since it need to collide with terrain.(not just on start)

I understand what you mean, but each time checking in collision if object wasnt “activated” and make what i did way arround is also bad.

dont want repeat all of above. but general info is simple:

“how in Physics make fallout4 physics initial behaviour(stay in sleep mode until its touched/attacked/etc)” and i was able ONLY by doing tricks.

It’s cool that they solved this for 4 because in 3 whenever you’d enter a new area, sometimes you’d hear the object rattling around as they settled. I haven’t played 4 enough to confirm or deny that it sometimes does the same thing.

1 Like

indeed, same fixed is in ugly 76 :smiley:

object rattling around as they settled

thats the main issue i solve same way as they did. I were just curious if could do it “more easy way” :slight_smile:

I’ve never played Fallout. Sorry!

i understand you could watch videos, but searching for situation where it is exactly visible might take you some time.

so i just quick found one of situations to show you:

see from 10:05

before he take space monkey, physics objects are in sleep mode, scene was loaded this way having sleep mode on this objects.

when he take space monkey(or if he just would touch/shoot it), the physics wake up from sleep mode for both monkey and elements it interact with. (well monkey is taken, but they just activate CO moment before take)

see the pillow, skeleton and other wake up from sleep mode when he take monkey.

and well, btw. its not only in Fallout games, i remember it was in many AAA physics open world based games.