Ejemplo n.º 1
0
        public virtual void satisify()
        {
            THREE.Vector3 diff          = DivVector.sub(p2.position, p1.position);
            var           currentLength = diff.length();

            if (currentLength == 0)
            {
                return;                     // prevents division by 0
            }
            setPosition();
        }
Ejemplo n.º 2
0
        public override THREE.Vector3 Constrain(THREE.Vector3 pos)
        {
            THREE.Vector3 diff = DivVector.sub(pos, Center).clone();
            if (diff.length() < Radius)
            {
                double dist = Radius - diff.length();

                diff.normalize().multiplyScalar(dist);
                return(diff);
            }
            return(null);
        }