2019年4月9日 星期二

Week08 +1 notes

開始期末專題:電流急急棒
本週做碰撞測試
球要加rigidbody
框加trigger

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class sss : MonoBehaviour
{
    public GameObject myBall;
    // Start is called before the first frame update
    void Start()
    {
     
    }

    // Update is called once per frame
    float x=0;
    void Update()
    {
        myBall.transform.position = new Vector3(x,0,0);
        x+=0.01f;
    }
    private void OnTriggerEnter(Collider other)
    {
        print("touch");     
    }

}

沒有留言:

張貼留言