Collision behaviour between a cube and a robot arm

i’m quite new to Unity and working with it, i recently started a job at my university and i’m trying to find my way around. Doesn’t realy matter though xD
I have a task to setup a simulation with Unity and the Franka Emika Panda (i think thats the right name) robot arm, where it picks up a block or someone hands a block to the robot arm and the arm puts the block down on a table or something like that.

The whole moving the robot stuff is working, but i’m trying to find a way so the robot can pick up the block and move it, without it falling out of the robots hands. I tried to set the block as a child of the robot as they collide with OnCollisionEnter (so that it moves exactly with the robot arm) but as soon as they collide, the cube moves to different positions and it also flickers weird? Not sure, also the colliders seem to trigger even though the cube does not touch the fingers of the robot yet?

This is the Script i used:

public class StickTogether : MonoBehaviour
    [SerializeField] private Transform normalParent, _newParent;

    private void OnCollisionEnter(Collision collision)

    private void OnCollisionExit(Collision collision)

And i uploaded pictures, but i also wanted to upload a video to show what i mean, maybe someone knows a way to do it, because it seems that i can only upload photos with my post.

Thanks in Advance for any help!

I’ll post some more pictures

The reason why cube moves different position when colliding with Robot arm is you didn’t reset the robot’s local position, rotation, scale.

this.transform.localPosition =;
this.transform.localRosition = Quaternion.identity;
this.transform.localPosition =;

This will fix your error, for sure.
And please upload the photos of Colliders of robot arm and box to figure it out.

Some weird collision based flickers must be because of unintentional collisions.
If the robot arm is not going to push the object around, just pick it up when it is in touch, then you can change the arm collider to trigger.
The object changing position can be either because of transform position issue or overlapping colliders.
For transform position issue, you can try changing second parameter of SetParent.
For overlapping collider, changing arm collider to trigger should fix it.
If you can’t change arm collider to trigger, you’ll need to disable one set of colliders (arm colliders in this case). You can disable arm collider when you change child hierarchy.

If i shrink the collider of the box, the collision flickers go away. Is it possible that the collision detection is working a little bit, let’s say wonky, because the distance between the colliders is so small? Between the two fingers is only 0.07 units space, if they are fully opened. With a block between them, it’s even smaller. Maybe that’s just screwing with the collision detection? I could probably fix the problem, if i just make the collider significantly smaller than the box. Don’t know if there is a better solution.
Also if i would change of the colliders to isTrigger, i would have to change my code from OnCollisionEnter to OnTriggerEnter right? And if i would disable the colliders from the arm, once the collision is made, do you have any idea how i could recognize if the robot let go of the block? Because once the collider is disabled, there is no OnCollisionExit or OnTriggerExit function right?

Thanks in advance again!

It didn’t sadly. It just made the block teleport to another position away from the robot arm. What exactly does it do? Why do i have to reset the local position of my block once it collides with the robot arm? I mean i want it to stay in collision with the arm, i just don’t want it to bug out.
The photos of the colliders are in my replies from yesterday. I wasn’t able to upload more than one photo per post, because i’m new to the forum.