Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.XR.iOS;
- public class SpawnBallOnTouch : MonoBehaviour
- {
- public GameObject spherePrefab;
- public float force = 5.0f;
- private Rigidbody rb;
- // Update is called once per frame
- void Update () {
- var touch = Input.GetTouch (0);
- if(touch.phase == TouchPhase.Began )
- {
- GameObject go = Instantiate (spherePrefab, transform.position, transform.rotation);
- go.GetComponent<Rigidbody>().velocity = transform.forward * force;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement