Commit f31b2ece authored by wanqing's avatar wanqing

修改代码

parent 65dcd7af
......@@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using RayFire;
using EzySlice;
//using EzySlice;
public class BombView : MonoBehaviour
{
......@@ -447,47 +447,47 @@ public class BombView : MonoBehaviour
m_lstDamage.Clear();
m_lstDamage = null;
}
void Slice()
{
Collider[] hits = Physics.OverlapBox(m_rayFireBlade.transform.position, new Vector3(5, 0.1f, 5), m_rayFireBlade.transform.rotation, layerMask);
Debug.LogError(hits.Length);
if (hits.Length <= 0)
return;
//void Slice()
//{
// Collider[] hits = Physics.OverlapBox(m_rayFireBlade.transform.position, new Vector3(5, 0.1f, 5), m_rayFireBlade.transform.rotation, layerMask);
// Debug.LogError(hits.Length);
// if (hits.Length <= 0)
// return;
for (int i = 0; i < hits.Length; i++)
{
//SlicedHull hull = SliceObject(hits[i].gameObject, crossMaterial);
SlicedHull hull = SliceObject(hits[i].gameObject);
if (hull != null)
{
GameObject bottom = hull.CreateLowerHull(hits[i].gameObject, crossMaterial);
GameObject top = hull.CreateUpperHull(hits[i].gameObject, crossMaterial);
AddHullComponents(bottom);
AddHullComponents(top);
Destroy(hits[i].gameObject);
}
}
}
// for (int i = 0; i < hits.Length; i++)
// {
// //SlicedHull hull = SliceObject(hits[i].gameObject, crossMaterial);
// SlicedHull hull = SliceObject(hits[i].gameObject);
// if (hull != null)
// {
// GameObject bottom = hull.CreateLowerHull(hits[i].gameObject, crossMaterial);
// GameObject top = hull.CreateUpperHull(hits[i].gameObject, crossMaterial);
// AddHullComponents(bottom);
// AddHullComponents(top);
// Destroy(hits[i].gameObject);
// }
// }
//}
void AddHullComponents(GameObject go)
{
go.layer = 9;
Rigidbody rb = go.AddComponent<Rigidbody>();
rb.interpolation = RigidbodyInterpolation.Interpolate;
MeshCollider collider = go.AddComponent<MeshCollider>();
collider.convex = true;
//void AddHullComponents(GameObject go)
//{
// go.layer = 9;
// Rigidbody rb = go.AddComponent<Rigidbody>();
// rb.interpolation = RigidbodyInterpolation.Interpolate;
// MeshCollider collider = go.AddComponent<MeshCollider>();
// collider.convex = true;
rb.AddExplosionForce(100, go.transform.position, 20);
}
// rb.AddExplosionForce(100, go.transform.position, 20);
//}
SlicedHull SliceObject(GameObject obj, Material crossSectionMaterial = null)
{
// slice the provided object using the transforms of this object
if (obj.GetComponent<MeshFilter>() == null)
return null;
//SlicedHull SliceObject(GameObject obj, Material crossSectionMaterial = null)
//{
// // slice the provided object using the transforms of this object
// if (obj.GetComponent<MeshFilter>() == null)
// return null;
return obj.Slice(m_rayFireBlade.transform.position, m_rayFireBlade.transform.up, crossSectionMaterial);
}
// return obj.Slice(m_rayFireBlade.transform.position, m_rayFireBlade.transform.up, crossSectionMaterial);
//}
//刀处理
void UpdateKniftHandle()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment