- Home /
 
Problem with acing problems with : OnTriggerEnter
Hi, so im gonna make this quick and simple.
Im having this problem (probably cause I'm a noob).
In the script (platescript, witch is attached to an object) the colour changes to white but it doesn't Execute Debug.Log("Attempting...") nor does it call .Do() in the other object. Am I missing something? Or does the universe hate me? P.S. This is a multiplayer game thingy I'm working on, and I don't receive any errors(i tested by levying out a ";" it did tell me i missed it so its something else i suspect) I would really appreciate it if yo spot whats wrong, thanks for reading!!! :D basically I'm making a plate witch someone steps on and it moves another object, it looks like the half of the script executes? cause it does change colour but nothing else :/
the two scripts:
platescript.cs :
 void executeT ()
 {
     Debug.Log ("Attepting...");
     renderer.material.color = Color.white;
     GameObject platF = GameObject.Find("platform");
     platF.GetComponent<platformScript>().Do ();
     
 }
 void OnTriggerEnter (Collider thing) {
     if (thing.gameObject.name == "MainChar") {
         executeT();
     }
     if (thing.gameObject.name == "Cube (Clone)") {
         executeT();
     }
 }
 
               And then:
 public Vector3 pointB;
 public IEnumerator Do()
 {
     var pointA = transform.position;
     yield return StartCoroutine(MoveObject(transform, pointA, pointB, 3.0f));
     Debug.Log("Starting...");
     
 }
 
 IEnumerator MoveObject(Transform thisTransform, Vector3 startPos, Vector3 endPos, float time)
 {
     var i= 0.0f;
     var rate= 1.0f/time;
     while (i < 1.0f) {
         i += Time.deltaTime * rate;
         thisTransform.position = Vector3.Lerp(startPos, endPos, i);
         yield return null; 
     }
 }
 
              Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
I can't get ANY simple collision to work! 3 Answers
Help in solving mistake in my code 1 Answer
On collision nearby objects ui view (scroll view) 0 Answers
Detecting mouse over PNG 0 Answers