123456789101112131415161718 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TestBox : MonoBehaviour
- {
- private void Start()
- {
- Bounds bounds = GetAllBounds.GetRendererBounds(gameObject);
- GameObject obj = new GameObject("Test");
- obj.transform.position = bounds.center;
- obj.AddComponent<BoxCollider>().size = bounds.size;
- // GetComponent<BoxCollider>().center = bounds.center - transform.position;
- GetComponent<BoxCollider>().size = bounds.size;
- }
- }
|