Interaction between Rigid and Kinematic 3D
Asked Answered
C

2

0

Hello everyone. I'm trying to figure out how to solve this: the thing is that I have two objects (both Rigid) falling together while touching each other. In a script I'd queue_free() the first object that touches the floor, who instanciates a self "replica", but Kinematic. The thing is that something happens to the other body (still rigid) who is touching it from above. At the moment in which the rigid body instanciates its "replica", the other object that remains rigid instantly fly away very, very fast.
I tried to disable both collisions shapes: the one from the rigid body before it's freed, and the one from the kinematic body (and then enabling it with a set deferred in it's script), but nothing change.
I'm using Godot 3.5...

Collie answered 6/2, 2023 at 20:24 Comment(0)
M
0

If you are moving the KinematicBody, try moving it with a non infinite inertia and then it shouldn’t apply a TON of force. It is the last argument in move_and_slide.

For the object being spawned in, if it overlaps then that could be causing the issue because of the collision margin on the collision shape. I would try reducing the margin and seeing if that helps.

Something else you could try as well is changing the RigidBody mode to Static on the non-KinematicBody, swap the KinematicBody, and then set the mode back to Rigid again on the non-KinematicBody. That might help reduce the sudden “it appears” aspect for the physics engine and that in turn may solve the issue.

Metamorphose answered 7/2, 2023 at 2:24 Comment(0)
C
0

Metamorphose
Yeap, deactivating the move_and_slide was my first try. Doesn't work.
Neither the margins thing.
Your third proposition seems to be the correct answer, but is a little bit complicated to implement in my project right now, so I will not try it at all... (after all, this is a minnor and very unusual "bug" in my game). I will consider it in the future if the project advance...
Thank you.

Collie answered 7/2, 2023 at 12:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.