Beispiel #1
0
    private IEnumerator ThrowDelay(Vector3 vel, Vector3 angVel, BaseGrabbable grabbable)
    {
        yield return(null);

        GetComponent <Rigidbody>().velocity        = vel * ThrowMultiplier;
        GetComponent <Rigidbody>().angularVelocity = angVel;
        if (ZeroGravityThrow)
        {
            grabbable.GetComponent <Rigidbody>().useGravity = false;
        }
    }
Beispiel #2
0
    public bool TrySetThrowableObject(BaseGrabbable grabbable, InteractionSourcePose poseInfo)
    {
        if (grabbable == null)
        {
            return(false);
        }

        if (!grabbable.GetComponent <BaseThrowable>())
        {
            return(false);
        }

        if (!grabbable.GetComponent <Rigidbody>())
        {
            return(false);
        }

        Rigidbody rb = grabbable.GetComponent <Rigidbody>();

        Debug.Log("name of our rb.center of mass ========= " + rb.name);
        ControllerReleaseData controlReleaseData = grabbable.GetComponent <Rigidbody>().GetThrowReleasedVelocityAndAngularVelocity(rb.centerOfMass, poseInfo);

        //grabbable.GetComponent<BaseThrowable>().LatestControllerThrowVelocity = vel;
        //grabbable.GetComponent<BaseThrowable>().LatestControllerThrowAngularVelocity = vel;

        grabbable.GetComponent <BaseThrowable>().LatestControllerThrowVelocity        = controlReleaseData.Velocity;
        grabbable.GetComponent <BaseThrowable>().LatestControllerThrowAngularVelocity = controlReleaseData.AngleVelocity;
        return(true);
    }
Beispiel #3
0
    public override void Throw(BaseGrabbable grabbable)
    {
        base.Throw(grabbable);
        //Vector3 vel = grabbable.GetAverageVelocity();
        Vector3 vel    = LatestControllerThrowVelocity;
        Vector3 angVel = LatestControllerThrowAngularVelocity;

        GetComponent <Rigidbody>().velocity        = vel * ThrowMultiplier;
        GetComponent <Rigidbody>().angularVelocity = angVel;
        if (ZeroGravityThrow)
        {
            grabbable.GetComponent <Rigidbody>().useGravity = false;
        }
    }