/** * Used to set the direction of the force applied to particles */ public Vector3 getNormalizedRelativePos(AbstractBodyController other) { if (other is ParticleController) { return((other.getCenter() - this.getCenter()).normalized); } else //As of now only plane { Vector3 planeCtrPoint = new Vector3(this.getCenter().x, other.getCenter().y, 0); return((this.getCenter() - planeCtrPoint).normalized); } }
public float getDistance(AbstractBodyController other) { if (other is ParticleController) { return(Vector3.Distance(this.getCenter(), other.getCenter())); } else //As of now only plane { Vector3 planeCtrPoint = new Vector3(this.getCenter().x, other.getCenter().y, 0); return(Vector3.Distance(this.getCenter(), planeCtrPoint)); } }
List <AbstractBodyController> getAllMovableBodies() { List <GameObject> allParticles = new List <GameObject>(); List <AbstractBodyController> allParticleControllers = new List <AbstractBodyController>(); allParticles.AddRange(hardBodies); allParticles.AddRange(particles); foreach (GameObject elasticBody in elasticBodies) { ElasticBodyController bc = elasticBody.GetComponent <ElasticBodyController>(); allParticles.AddRange(bc.getParticles()); } foreach (GameObject particle in allParticles) { AbstractBodyController ctrl = particle.GetComponent <AbstractBodyController>(); allParticleControllers.Add(ctrl); } return(allParticleControllers); }