It is possible to switch off the box collider ?

Hello everyone ! Iā€™m new on unity , and I 'm starting to study for a few days , I have two simple questions for you , I hope you can help me

  1. It is possible to switch of the Box collider before the WaitforSecond ?? What is the script for do this ?
  2. It is possible to move an object to the Y world axis for one unit ? With this script at time my cube fly away :smiley:

Thank you my friends :slight_smile:

Question 1) The code you have will set the gameObject to inactive, not the collider. Use this instead:

other.enabled = false;

Obviously you would set it to true to turn it back on.

Question 2) You are translating your transform in update, so it is going move by that amount every frame. You need to use a condition to stop the movement like in the code below.

private bool move;

void Update(){    
		transform.Translate(Vector3.up * Mtranslation);
		move = false;

void OnTriggerEnter(Collider other){
		move = true;

Thank you man ! Very nice ! Iā€™m trying :slight_smile:

edit: it is working :smiley: