示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        playerPickUp pPUScript = GetComponentInParent <playerPickUp>();

        pPUScript.canCarry = true;
        transform.GetComponent <Rigidbody>().useGravity = true;
        transform.parent = null;
        Destroy(gameObject.GetComponent <extGrabbedBehave>());
    }
示例#2
0
    private void throwMe() //Throw Physics
    {
        playerPickUp pPUScript = GetComponentInParent <playerPickUp>();

        transform.GetComponent <Rigidbody>().AddForce(transform.parent.forward * GetComponentInParent <playerBehavior>().throwForce, ForceMode.Impulse); //Adds force to object
        pPUScript.canCarry = true;                                                                                                                       //Don't show we can carry till after this thing already starts launching
        transform.parent   = null;
        transform.GetComponent <Rigidbody>().useGravity = true;
        Destroy(gameObject.GetComponent <extGrabbedBehave>());
    }