Re-enabling collision on a rigidbody not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameVisitor

Hey all,

I am trying to temporary disable the collision shape (child) of a rigid body, then re-enabling it as suggested here, using:

mRigid.mode =  MODE_STATIC 
get_node("Collision-cube").disabled = true

and then

mRigid.mode =  MODE_RIGID 
get_node("Collision-cube").disabled = false

This works well for a while, then suddenly, when more objects are created, some collision are not detected anymore… (tried using CCD, can_sleep = false, sleeping = false…not to avail)

Any specific rule I should respect when toggling off/on collision shape ?

Thx

I noticed this happens after reloading my scene (my game reloads the main scene indefinitely with random parameters).

I also noticed that my objects are not “pickable” anymore:

func _input_event(camera, event, pos, normal, shape):

callback not being called anymore.
Also found this error in Android logcat, that i am feel is related to my problem but can’t figure it out…

02-24 09:44:03.017 17885 17933 I GLSurfaceView: OpenGL:org.godotengine.mygame Skipped 58 frames!
02-24 09:44:03.575 17885 17933 I GLSurfaceView: OpenGL:org.godotengine.mygame Skipped 33 frames!

Thanks for any advice I can get :slight_smile:

GameVisitor | 2019-02-24 07:56

:bust_in_silhouette: Reply From: GameVisitor

I couldn’t find exactly the problem, except that I used a backup-ed copy of my scene and the problem went away. I am sure that the issue is not related to my gd script since using the same script with the old scene made the bug disappeared.