public PositionPlane Initialize(RuntimeTransformHandle p_runtimeHandle, Vector3 p_axis1, Vector3 p_axis2, Vector3 p_perp, Color p_color)
        {
            _parentTransformHandle = p_runtimeHandle;
            _defaultColor          = p_color;
            _axis1 = p_axis1;
            _axis2 = p_axis2;
            _perp  = p_perp;

            InitializeMaterial();

            transform.SetParent(p_runtimeHandle.transform, false);

            _handle = new GameObject();
            _handle.transform.SetParent(transform, false);
            MeshRenderer mr = _handle.AddComponent <MeshRenderer>();

            mr.material = _material;
            MeshFilter mf = _handle.AddComponent <MeshFilter>();

            mf.mesh = MeshUtils.CreateBox(.02f, .5f, 0.5f);
            MeshCollider mc = _handle.AddComponent <MeshCollider>();

            _handle.transform.localRotation = Quaternion.FromToRotation(Vector3.up, _perp);
            _handle.transform.localPosition = (_axis1 + _axis2) * .25f;

            return(this);
        }
예제 #2
0
        public ScaleGlobal Initialize(RuntimeTransformHandle p_parentTransformHandle, Vector3 p_axis, Color p_color)
        {
            _parentTransformHandle = p_parentTransformHandle;
            _axis = p_axis;
            _defaultColor = p_color;
            
            InitializeMaterial();

            transform.SetParent(p_parentTransformHandle.transform, false);

            GameObject o = new GameObject();
            o.transform.SetParent(transform, false);
            MeshRenderer mr = o.AddComponent<MeshRenderer>();
            mr.material = _material;
            MeshFilter mf = o.AddComponent<MeshFilter>();
            mf.mesh = MeshUtils.CreateBox(.35f, .35f, .35f);
            MeshCollider mc = o.AddComponent<MeshCollider>();

            return this;
        }
예제 #3
0
        public ScaleAxis Initialize(RuntimeTransformHandle p_runtimeHandle, Vector3 p_axis, Vector3 p_perp,
                                    Color p_color)
        {
            _parentTransformHandle = p_runtimeHandle;
            _axis         = p_axis;
            _perp         = p_perp;
            _defaultColor = p_color;

            InitializeMaterial();

            transform.SetParent(p_runtimeHandle.transform, false);

            GameObject o = new GameObject();

            o.transform.SetParent(transform, false);
            MeshRenderer mr = o.AddComponent <MeshRenderer>();

            mr.material = _material;
            MeshFilter mf = o.AddComponent <MeshFilter>();

            mf.mesh = MeshUtils.CreateCone(p_axis.magnitude * SIZE, .02f, .02f, 8, 1);
            MeshCollider mc = o.AddComponent <MeshCollider>();

            mc.sharedMesh             = MeshUtils.CreateCone(p_axis.magnitude * SIZE, .1f, .02f, 8, 1);
            o.transform.localRotation = Quaternion.FromToRotation(Vector3.up, p_axis);
            o.layer = p_runtimeHandle.raycastLayer;

            o = new GameObject();
            o.transform.SetParent(transform, false);
            mr          = o.AddComponent <MeshRenderer>();
            mr.material = _material;
            mf          = o.AddComponent <MeshFilter>();
            mf.mesh     = MeshUtils.CreateBox(.25f, .25f, .25f);
            mc          = o.AddComponent <MeshCollider>();
            o.transform.localRotation = Quaternion.FromToRotation(Vector3.up, p_axis);
            o.transform.localPosition = p_axis * SIZE;
            o.layer = p_runtimeHandle.raycastLayer;

            return(this);
        }