Example #1
0
        public override cVector3 force(cCritter pcritter)
        {
            if (_pnode == null)
            {
                return(new cVector3(0.0f, 0.0f, 0.0f));
            }
            cDistanceAndDirection dirdic =
                pcritter.distanceAndDirectionTo(_pnode);

            if (dirdic._distance < 0.00001f)
            {
                return(new cVector3(0.0f, 0.0f, 0.0f));
            }
            float pull = (_intensity * _pnode.Mass * pcritter.Mass) /
                         ((dirdic._distance) * (dirdic._distance));

            return(dirdic._direction * pull);
        }