void Start() { if (!electromagneticFieldController) { electromagneticFieldController = GameObject.Find("ElectromagneticFieldController"); if (!electromagneticFieldController) { throw new System.Exception("Could not find ElectromagneticFieldController"); } } controller = electromagneticFieldController.GetComponent <ElectromagneticFieldControllerScript>(); if (!collider) { throw new System.Exception("Only objects with a collider can be made magnetizable"); } if (!rigidbody) { throw new System.Exception("Only objects with a rigidbody can be made magnetizable"); } if (strength < 0.0f) { throw new System.Exception("Magnetization strength must be non-negative"); } }
// Use this for initialization void Start() { if (this.Controller == null) { this.Controller = GameObject.FindObjectOfType <ElectromagneticFieldControllerScript> (); } }
void Start() { if (!electromagneticFieldController) { electromagneticFieldController = GameObject.Find("ElectromagneticFieldController"); if (!electromagneticFieldController) { throw new System.Exception("Could not find ElectromagneticFieldController"); } } controller = electromagneticFieldController.GetComponent <ElectromagneticFieldControllerScript>(); controller.RegisterElectricField(ElectricField); }
void Start() { if (!electromagneticFieldController) { electromagneticFieldController = GameObject.Find("ElectromagneticFieldController"); if (!electromagneticFieldController) { throw new System.Exception("Could not find ElectromagneticFieldController"); } } controller = electromagneticFieldController.GetComponent <ElectromagneticFieldControllerScript>(); #if I_HAVE_DEBUGLINE Debug.Log("Creating debug line..."); line = new FieldDebugLineScript.DebugVectorLine(gameObject.name + "Line", new Vector3[numberOfSegments]); //, color, lineMaterial, thickness, LineType.Continuous); //line.joins = Joins.Weld; //line.maxWeldDistance = 5; #else #if SHOW_VECTROSITY_ERRORS throw new System.Exception("FieldLines have been disabled because Vectrosity might not be available on your system. To enable them, open Magnetodynamics/ObjectsToPlaceInYourScene/_ScriptsThatMakeThemWork/FieldLineScript and remove the '//' before '#define I_HAVE_DEBUGLINE'. To hide this error message instead, remove the '#define SHOW_VECTROSITY_ERRORS' line in the same script."); #endif #endif if (whichField == WhichField.Electric) { field = controller.ElectricField; } else if (whichField == WhichField.Magnetic) { field = controller.MagneticField; } if (accuracy == Accuracy.EulersMethod) { calculate = EulersMethod; } else if (accuracy == Accuracy.SecondOrderMethod) { calculate = SecondOrderMethod; } else if (accuracy == Accuracy.RungeKuttaMethod) { calculate = RungeKuttaMethod; } }
void Start() { if (!electromagneticFieldController) { electromagneticFieldController = GameObject.Find("ElectromagneticFieldController"); if (!electromagneticFieldController) { throw new System.Exception("Could not find ElectromagneticFieldController"); } } controller = electromagneticFieldController.GetComponent <ElectromagneticFieldControllerScript>(); theParticleSystem = gameObject.GetComponent <ParticleSystem>(); if (!theParticleSystem) { throw new System.Exception("Could not find ParticleSystem"); } particles = new ParticleSystem.Particle[maxParticles]; }
// Use this for initialization void Start() { if (this.Controller == null) { this.Controller = GameObject.FindObjectOfType <ElectromagneticFieldControllerScript> (); } FieldValues = new VolumeBuffer <Vector3> (Cubic <int> .CreateSame(CubeSize)); if (this.UseDebugMesh) { var mf = this.GetComponent <MeshFilter> (); if (mf == null) { this.UseDebugMesh = false; Debug.Assert(mf != null, "Please setup a MeshFilter and MeshRenderer on this object"); } SurfaceMesh = new Mesh(); MeshVertices = new Vector3[FieldValues.Length * 3]; MeshNormals = new Vector3[FieldValues.Length * 3]; mf.mesh = SurfaceMesh; } }