public override bool CheckCollision(ClothParticle p, bool elastic, ClothSim cloth)
    {
        Vector3 dir = p.pos - transform.position;

        if (p.pos.y < transform.position.y)
        {
            p.pos = new Vector3(p.pos.x, transform.position.y, p.pos.z);
            //p.acceleration = Vector3.zero;
            return(true);
        }
        return(false);
    }
    public override bool CheckCollision(ClothParticle p, bool elastic, ClothSim cloth)
    {
        Vector3 dif = p.pos - transform.position;

        if (dif.magnitude < radius)
        {
            Vector3 dir = dif.normalized;
            dir *= (radius + 0.001f);

            p.pos          = dir + transform.position;
            p.acceleration = Vector3.zero;
            return(true);
        }
        return(false);
    }
Example #3
0
    public override bool CheckCollision(ClothParticle p, bool elastic, ClothSim cloth)
    {
        Vector3 dir = p.pos - transform.position;

        if (p.pos.x < transform.position.x + (boundingBox.x / 2) &&
            p.pos.x > transform.position.x - (boundingBox.x / 2) &&
            p.pos.y < transform.position.y + (boundingBox.y / 2) &&
            p.pos.y > transform.position.y - (boundingBox.y / 2) &&
            p.pos.z < transform.position.z + (boundingBox.z / 2) &&
            p.pos.z > transform.position.z - (boundingBox.z / 2))
        {
            //dir.Normalize();
            p.acceleration = Vector3.zero;
            return(true);
        }
        return(false);
    }
Example #4
0
 public abstract bool CheckCollision(ClothParticle p, bool elastic, ClothSim cloth);