예제 #1
0
        public void checkSphere(Sphere_s colliders, int index)
        {
            Vector3 P  = particles[index].nextPosition - colliders.Position;
            float   cR = colliders.Radius * 1.08f; // длина образующей поверхности 1,05 https://life-prog.ru/1_43663_bokovoy-poverhnosti-kolodki.html

            if (P.LengthSquared < cR * cR)
            {
                P.Normalize();
                P *= cR;
                particles[index].nextPosition = P + colliders.Position;
                particles[index].nextVelocity = Vector3.Zero;
            }
        }
예제 #2
0
파일: Cloth.cs 프로젝트: Xar0n/ClothForm
        public void addSphere(Vector3 position, float radius)
        {
            var col = new Sphere_s(position, radius);

            sphere = col;
        }