Created
June 5, 2016 04:40
-
-
Save Drenerdo/ebdf230384d244578ffc3a76cb9c8a61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class throwarea : MonoBehaviour { | |
// Use this for initialization | |
void Start () { | |
} | |
// Update is called once per frame | |
void Update () { | |
} | |
void OnTriggerEnter(Collider col) { | |
if (col.transform.name == "WristLeft" && ball.s.lefthasball){ | |
Debug.Log ("ball_throw_area_left"); | |
Vector3 ballpos = ball.s.leftball.transform.position; | |
ball.s.leftball.parent = null; | |
ball.s.leftball.localScale = new Vector3 (0.18f, 0.18f, 0.18f); | |
ballpos.z -= 0.25f; | |
ball.s.leftball.transform.position = ballpos; | |
Rigidbody rigidball = ball.s.leftball.GetComponent<Rigidbody> (); | |
rigidball.isKinematic = false; | |
rigidball.useGravity = true; | |
rigidball.AddForce (new Vector3 (0, 0, -1000f)); | |
ball.s.lefthasball = false; | |
ball.s.leftball = null; | |
//ball.s.leftball.GetComponent<Rigidbody>().is | |
} | |
if (col.transform.name == "WristRight" && ball.s.righthasball) { | |
Debug.Log ("ball_throw_area_right"); | |
Vector3 ballpos = ball.s.rightball.transform.position; | |
ball.s.rightball.parent = null; | |
ball.s.rightball.localScale = new Vector3 (0.18f, 0.18f, 0.18f); | |
ballpos.z -= 0.25f; | |
ball.s.rightball.transform.position = ballpos; | |
Rigidbody rigidball = ball.s.rightball.GetComponent<Rigidbody> (); | |
rigidball.isKinematic = false; | |
rigidball.useGravity = true; | |
rigidball.AddForce (new Vector3 (0, 0, -500f)); | |
ball.s.righthasball = false; | |
ball.s.rightball = null; | |
//ball.s.rightball.transform.Translate (new Vector3 (0, 0, -2f)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment