How to create a crane telescopic boom?

I boys! I have two cubes.
one of these cube is a son of the other cube
I want that one cube will move only if the other cube has reached its maximum extension like a boom.

And at the same way I want the parent cube can move only if the child cube is completely shortened.

Any idea to do this?

Im trying to read variables from one script to another to import the value of Transform.localPosition.y that should work as a sensor that knows when a cube or the other must move

Sorry for the english and thanks

Have you checked out iTween its really sweet!
http://itween.pixelplacement.com/index.php

Then I would do something like

var boomSection1 : GameObject;
var boomSection2 : GameObject;

function Update () 
{
	iTween.MoveTo(boomSection1,{"y": 2, "time":2, "onComplete":"Boom2"});
		
}
function Boom2()
{
	iTween.MoveTo(boomSection2,{"y": 4, "time":4});
}

P.S. I really dig cranes :slight_smile:

sorry but I don’t understand. I need an Help with basic unityscript. I’m beginner

If you need help with basic Unity Scripting you can try these Then when you have a little more understanding you can move onto iTween which makes it even easier in some situations.

http://www.unity3dstudent.com/
http://walkerboystudio.com/html/unity_training___free__.html

and there is also the turboTwins on youtube

After you have a better understanding the script above will make sense :slight_smile:

is iTween free?

Yes.

I tryed it! but I believe it is an animation and not a movement by key pressing sensibility. I want to check frame by frame the elongation of the crane