Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Collectible : MonoBehaviour
- {
- Rigidbody rb;
- // Start is called before the first frame update
- void Start()
- {
- rb = GetComponent<Rigidbody>();
- }
- // Update is called once per frame
- void Update()
- {
- }
- private void FixedUpdate()
- {
- Vector3 r = new Vector3(0,1,0) * 200;
- rb.AddTorque(r);
- }
- private void OnTriggerEnter(Collider other)
- {
- if(other.name == "Player")
- {
- other.GetComponent<Player>().score += 1;
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement