Ejemplo n.º 1
0
        public void ActualUpdate()
        {
            if (!enabled)
            {
                return;
            }

            m_force_data.info.shape_type     = m_shape_type;
            m_force_data.info.dir_type       = m_direction_type;
            m_force_data.info.strength       = m_strength_near;
            m_force_data.info.random_diffuse = m_random_diffuse;
            m_force_data.info.random_seed    = m_random_seed;
            m_force_data.info.direction      = m_direction;
            m_force_data.info.center         = transform.position;
            m_force_data.info.rcp_cellsize   = new Vector3(1.0f / m_vectorfield_cellsize.x, 1.0f / m_vectorfield_cellsize.y, 1.0f / m_vectorfield_cellsize.z);
            if (m_shape_type == CSForceShape.Sphere)
            {
                m_force_data.sphere.center = transform.position;
                m_force_data.sphere.radius = transform.localScale.x;
            }
            else if (m_shape_type == CSForceShape.Box)
            {
                Vector3   zero = Vector3.zero;
                Vector3   one  = Vector3.one;
                Matrix4x4 m    = transform.localToWorldMatrix;
                MPGPImpl.BuildBox(ref m_force_data.box, ref m, ref zero, ref one);
            }
            EachTargets((t) => { t.AddForce(ref m_force_data); });
        }
 void OnDrawGizmos()
 {
     if (!enabled)
     {
         return;
     }
     m_trans = GetComponent <Transform>();
     MPGPImpl.BuildCapsuleCollider(ref m_collider_data, m_trans, ref m_center, m_radius, m_height, (int)m_direction, m_id);
     Gizmos.color = MPGPImpl.ColliderGizmoColor;
     Gizmos.DrawWireSphere(m_collider_data.shape.pos1, m_radius);
     Gizmos.DrawWireSphere(m_collider_data.shape.pos2, m_radius);
     Gizmos.DrawLine(m_collider_data.shape.pos1, m_collider_data.shape.pos2);
     Gizmos.matrix = Matrix4x4.identity;
 }
Ejemplo n.º 3
0
 public override void ActualUpdate()
 {
     MPGPImpl.BuildBoxCollider(ref m_collider_data, m_trans, ref m_center, ref m_size, m_id);
     EachTargets((t) => { t.AddBoxCollider(ref m_collider_data); });
 }
 public override void ActualUpdate()
 {
     MPGPImpl.BuildCapsuleCollider(ref m_collider_data, m_trans, ref m_center, m_radius, m_height, (int)m_direction, m_id);
     EachTargets((t) => { t.AddCapsuleCollider(ref m_collider_data); });
 }
 public override void ActualUpdate()
 {
     MPGPImpl.BuildSphereCollider(ref m_collider_data, m_trans, ref m_center, m_radius, m_id);
     EachTargets((t) => { t.AddSphereCollider(ref m_collider_data); });
 }