- Home /
Question by
CB-TV · Feb 02, 2014 at 01:13 PM ·
move an objectscriptable objectdrag objectspick up object
Rigidbody Not Move
I want to do something like in Skrim when you hold E and you can pick up an object. Like THIS. I've done most of it but all I want to know how to do is to make the object stay infront of the camera. I've done this:
object.localPosition = Vector3.forward * 2;
rigidbody.useGravity = false;
but the object will push through objects instead of colliding with them properly.
I have tried this aswell but it's just too glitchy:
private var collisionCount = 0;
function OnCollisionEnter ()
{
collisionCount++;
}
function OnCollisionExit ()
{
collisionCount--;
}
if (collisionCount == 0)
{
object.localPosition = Vector3.forward * 2;
}
Comment