Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        public void addSphere(Vector3 position, float radius)
        {
            var col = new Sphere_s(position, radius);

            sphere = col;
        }