Hey people at the unity forums, I’ve got a quite big porblem, I’ve trying everything I know to get this lifitng function to work.
Let me explain:
What I want is the player being able to pickup physics with his “hand”
So I need someway of holding the object while holding the mouse button down, then dropping it when you release the mouse button.
And you should be able to move around with it and place it wherever you want.
Quite similiar to the Gravity Gun in Half Life 2.
Or identic with the interaction system of “Penumbra”
EDIT:
var player : Rigidbody;
function OnMouseDown()
{
gameObject.AddComponent("FixedJoint");
fixedJoint = gameObject.GetComponent (FixedJoint);
fixedJoint.connectedBody = player;
rigidbody.useGravity = false;
}
function OnMouseDrag()
{
fixedJoint = gameObject.GetComponent (FixedJoint);
fixedJoint.connectedBody = player;
}
function OnMouseUp()
{
fixedJoint = gameObject.GetComponent (FixedJoint);
fixedJoint.connectedBody = null;
fixedJoint.breakForce = 0;
rigidbody.useGravity = true;
}
This is what I’ve been using and it works well, apart from the object being held will not stay still in the middle, it will go flying mad if you turn around to quickly.
Thanks in advance.