示例#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);
        }
示例#2
0
 public void copy(cDistanceAndDirection dd)
 {
     _distance = dd._distance;
     _direction.copy(dd._direction);
 }