Parenting - for lifting objects?

I’ve tried to make a simple lift script by collission Enter and Transform.parent = transform;

can i do this on a rigidbidy? or do i have to make it Kinematic? ive tried alot of combinations but nothing seems to work properly

You can. Just make it kinematic with no gravity when you want it to move exactly with the grabber.

i would appreciate if you could post some example…
i dont really wanna show my poor scripting attempt :stuck_out_tongue:

EDIT:

i think i got it.

var object : GameObject; // <-- do i need this?
var transform2 : Transform;


function OnCollisionEnter(objekt: Collision){

object.rigidbody.isKinematic = true;
object.transform.parent = transform2.transform;

}

now my object follows the transform i want. but when it collides with the world… how do i setup so i only collide with one spesific object?

Assuming that the collision is on the right spot and the object with the script is the grabber…

function OnCollisionEnter(hit : Collision)
{
   hit.transform.parent = transform;
   hit.rigidbody.isKinematic = true;
   hit.rigidbody.useGravity = false;
}

function DropBox(hit : Transform)
{
   hit.parent = null;
   hit.rigidbody.isKinematic = false;
   hit.rigidbody.useGravity = true;
}

thanks :smile: