I am making a game where an integral part of it is that I would be able to pick up cubes and move them to different places, as well as grab ahold of a moving platform from the bottom so that I move with it. One of my ideas (actually the idea that I want), is to be able to make the cube sticky (by adding a joint when it collides), and then stcking it to the underside of the moving platform. However, I don't know how to hold an object in that way. I can't make it a child of the camera, because then when it moves the character and camera won't, but if I make my character be a child of the cube, then I can't move the cube. A javascript would be nice. Thanks in advance.
Parenting is the easiest way, but you said you cannot use that. Next would probably be simply setting the cubes position to be right in front of your character.
//PlayerController.js
private var pickedUpObj : Transform;
function Update () {
//Add code for selecting an object. The easiest way is probably Physics.OverlapSphere()
pickedUpObj.position = transform.position + transform.forward;
//Places the cube 1 unit in front of the player.
}
If your player is controlled by a Rigidbody, then you could add a FixedJoint to your cube and it will stick.