Пример #1
0
 internal void OnColliderIntersect(Physics.collision collision)
 {
     for (int i = 0; i < components.Count; i++)
     {
         components[i].OnCollision(collision);
     }
 }
        public override void OnCollision(Physics.collision collision)
        {
            var m = gameObject.GetComp <MeshRenderer>().mesh;

            Console.WriteLine("daw");
            //m.vertices.RemoveAt(0);
            //m.Apply();
        }
Пример #3
0
        public override void OnCollision(collision collision)
        {
            if (isSolid)
            {
                transform.position += collision.direction;
            }

            var f = collision.direction.normalized;

            //Console.WriteLine(f);
            motion = motion.reflect(f);
        }
Пример #4
0
        public override bool Intersects(SphereCollider other, out collision?collision)
        {
            var dir   = other.getWorldPos() - getWorldPos();
            var dist  = dir.length;
            var dirn  = dir.normalized;
            var point = transform.position + dirn * radius;

            collision = null;
            if (dist - other.radius < radius)
            {
                collision = new collision(other, point, dirn * (dist - (radius + other.radius)));
                return(true);
            }

            return(false);
        }
Пример #5
0
 // collision
 public virtual void OnCollision(Physics.collision collision)
 {
 }