Example #1
0
 public void SetData(NParticle particle)
 {
     position     = particle.position;
     velocity     = particle.velocity;
     acceleration = particle.acceleration;
     netForce     = particle.netForce;
     massInv      = particle.massInv;
 }
Example #2
0
 public void SetData(NParticle a, NParticle b)
 {
     positionA = a.position;
     positionB = b.position;
     mass.x    = a.mass;
     mass.y    = b.mass;
     output    = Vector3.zero;
 }
Example #3
0
 public void Insert(NParticle particle)
 {
     if (baseNode == null)
     {
     }
     else if (baseNode.IsExternal())
     {
     }
     else
     {
     }
 }
Example #4
0
 private void Awake()
 {
     particle = GetComponent <NParticle>();
     radius   = GetComponent <MeshRenderer>().bounds.size.x * .5f;
 }
Example #5
0
 Quadrant(Vector3 center, Vector3 halfWidths, NParticle particle = null)
 {
     this.center     = center;
     this.halfWidths = halfWidths;
     this.particle   = particle;
 }
Example #6
0
 public void RemoveItem(NParticle particle)
 {
     particles.Remove(particle);
     particleDataBuffer = new ParticleData[particles.Count];
     physicsDataBuffer  = new PhysicsData[particles.Count * particles.Count];
 }
Example #7
0
    private void SolveGravity(NParticle a, NParticle b)
    {
        Vector3 distance = b.position - a.position;

        a.netForce = (G * a.mass * b.mass * distance.normalized) / Vector3.Dot(distance, distance);
    }