Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 // collision
 public virtual void OnCollision(Physics.collision collision)
 {
 }